Fisher Yates Shuffle for cards or any number of items
#3
Nearly as fast but you are doing one extra swap.

But more importantly, it is less efficient, you are swapping each time with a random from whole set which can cause ripples or waves that upset a normal distribution. The wiki will confirm this but the math is quite wonky.
https://en.wikipedia.org/wiki/Fisher–Yates_shuffle see Naive method which is yours basically.
b = b + ...
Reply


Messages In This Thread
RE: Fisher Yates Shuffle for cards or any number of items - by bplus - 06-20-2023, 09:33 AM



Users browsing this thread: 1 Guest(s)