From ec6185cd3196776c2eacc120ebcb50e937b175db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 18:20:19 +0900 Subject: [PATCH] Reduce random allocations --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 206d7e649f..5b69247451 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -36,16 +36,15 @@ namespace osu.Game.Rulesets.Osu.Mods var osuObject = (OsuHitObject)drawable.HitObject; Vector2 origin = drawable.Position; - Random distRand = new Random(osuObject.ComboOffset); - Random angleRand = new Random(osuObject.IndexInCurrentCombo); + Random objRand = new Random((int)osuObject.StartTime); // Wiggle all objects during TimePreempt int amountWiggles = (int)osuObject.TimePreempt / wiggle_duration; void wiggle() { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + float nextAngle = (float)(objRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(objRand.NextDouble() * wiggle_strength); drawable.MoveTo(new Vector2((float)(nextDist * Math.Cos(nextAngle) + origin.X), (float)(nextDist * Math.Sin(nextAngle) + origin.Y)), wiggle_duration); }