mirror of https://github.com/ppy/osu
Fix possible exception caused by `log(0)`
This commit is contained in:
parent
3356742ba2
commit
a912bcadf8
|
@ -212,8 +212,8 @@ public static bool IsHitObjectOnBeat(OsuBeatmap beatmap, OsuHitObject hitObject,
|
|||
|
||||
public static float RandomGaussian(Random rng, float mean = 0, float stdDev = 1)
|
||||
{
|
||||
double x1 = rng.NextDouble();
|
||||
double x2 = rng.NextDouble();
|
||||
double x1 = 1 - rng.NextDouble();
|
||||
double x2 = 1 - rng.NextDouble();
|
||||
double stdNormal = Math.Sqrt(-2 * Math.Log(x1)) * Math.Sin(2 * Math.PI * x2);
|
||||
return mean + stdDev * (float)stdNormal;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue