Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the actual Fisher-Yates shuffle. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

player-03
Copy link

Your implementation does technically show up on the Wikipedia page, but unfortunately, it shows up under "implementation errors":

always selecting j from the entire range of valid array indices on every iteration also produces a result which is biased, albeit less obviously so.

I've modified it to match the second example listed under "the modern algorithm."

@player-03
Copy link
Author

Actually, roobie linked to a better explanation of what's wrong.

@player-03
Copy link
Author

Hey, I just noticed this hasn't been merged yet. Why not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant