Order bias in wrong implementation of Fisher Yates Shuffle

限于喜欢 提交于 2019-11-29 16:48:50

This is not a proof by any means, but you can quickly come up with the distribution of placement probabilities by running the biased algorithm a million times. It will look like this picture from wikipedia:

An unbiased distribution would have 14.3% in every field.

To get the most likely distribution, I think it's safe to just pick the highest percentage for each index. This means it's most likely that the entire array is moved down by one and the first element will become the last.

Edit: I ran some simulations and this result is most likely wrong. I'll leave this answer up until I can come up with something better.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!