Core/Random: Changed random functions returning doubles to return floats
Port From (https://github.com/TrinityCore/TrinityCore/commit/9894f6b802c974bb36acd7fbb0d083455a1f0f1b)
This commit is contained in:
@@ -158,7 +158,7 @@ namespace System.Collections.Generic
|
||||
{
|
||||
float totalWeight = sequence.Sum(weightSelector);
|
||||
// The weight we are after...
|
||||
float itemWeightIndex = (float)RandomHelper.NextDouble() * totalWeight;
|
||||
float itemWeightIndex = RandomHelper.NextSingle() * totalWeight;
|
||||
float currentWeightIndex = 0;
|
||||
|
||||
foreach (var item in from weightedItem in sequence select new { Value = weightedItem, Weight = weightSelector(weightedItem) })
|
||||
|
||||
@@ -16,9 +16,9 @@ public class RandomHelper
|
||||
/// Returns a random number between 0.0 and 1.0.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static double NextDouble()
|
||||
public static float NextSingle()
|
||||
{
|
||||
return rand.NextDouble();
|
||||
return rand.NextSingle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user