1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Make random generator a field to avoid passing around internally

This commit is contained in:
Dean Herbert 2021-05-26 16:37:30 +09:00
parent 6181b1ac92
commit 6ca9b37c28

View File

@ -40,6 +40,8 @@ namespace osu.Game.Rulesets.Osu.Mods
private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast;
private Random rng;
[SettingSource("Seed", "Use a custom seed instead of a random one", SettingControlType = typeof(OsuModRandomSettingsControl))]
public Bindable<int?> Seed { get; } = new Bindable<int?>
{
@ -56,7 +58,7 @@ namespace osu.Game.Rulesets.Osu.Mods
Seed.Value ??= RNG.Next();
var rng = new Random((int)Seed.Value);
rng = new Random((int)Seed.Value);
RandomObjectInfo prevObjectInfo = null;
@ -83,9 +85,7 @@ namespace osu.Game.Rulesets.Osu.Mods
continue;
}
applyRandomisation(
rng,
rateOfChangeMultiplier,
applyRandomisation(rateOfChangeMultiplier,
prevObjectInfo,
distanceToPrev,
currentObjectInfo