FlxRandom.shuffleArray implementation - why not Fisher-Yates?

26 views
Skip to first unread message

Aaron Pieper

unread,
Mar 7, 2016, 9:16:32 PM3/7/16
to HaxeFlixel
Is there a reason why HaxeFlixel's FlxRandom.shuffleArray implementation uses an unconventional shuffling algorithm, instead of a Fisher Yates shuffle? Couldn't it use something similar to the Random.shuffle<T> algorithm defined here? https://github.com/jasononeil/hxrandom/blob/master/src/Random.hx

The current algorithm is slower than Fisher-Yates, and often leaves items in their original position. Is there a reason why a partially shuffled array is useful for HaxeFlixel?
Reply all
Reply to author
Forward
0 new messages