Moved RNG initialisation to a better place

This commit is contained in:
Henry Lin 2021-06-24 11:29:10 +08:00
parent 6fca8ba5b0
commit f74275a3b5

View File

@ -93,6 +93,8 @@ namespace osu.Game.Rulesets.Osu.Mods
private List<OsuHitObject> origHitObjects;
private Random rng;
#endregion
#region Sudden Death (IApplicableFailOverride)
@ -161,6 +163,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override void ApplyToBeatmap(IBeatmap beatmap)
{
Seed.Value ??= RNG.Next();
rng = new Random(Seed.Value.GetValueOrDefault());
var osuBeatmap = (OsuBeatmap)beatmap;
@ -284,8 +287,6 @@ namespace osu.Game.Rulesets.Osu.Mods
{
if (hitObjects.Count == 0) return;
var rng = new Random(Seed.Value.GetValueOrDefault());
float nextSingle(float max = 1f) => (float)(rng.NextDouble() * max);
var direction = MathHelper.TwoPi * nextSingle();