1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

Add NextSingle of version taking output range to StatelessRNG

This commit is contained in:
ekrctb 2021-06-04 19:52:12 +09:00
parent 181f1da3d3
commit 5512231bf4

View File

@ -75,5 +75,10 @@ namespace osu.Game.Utils
/// </param>
public static float NextSingle(int seed, int series = 0) =>
(float)(NextULong(seed, series) & ((1 << 24) - 1)) / (1 << 24); // float has 24-bit precision
/// <summary>
/// Compute a random floating point value between <paramref name="min"/> and <paramref name="max"/> from given seed and series number.
/// </summary>
public static float NextSingle(float min, float max, int seed, int series = 0) => min + NextSingle(seed, series) * (max - min);
}
}