Skip to content

Commit

Permalink
Correct common implementation error in Fisher-Yates
Browse files Browse the repository at this point in the history
  • Loading branch information
briandoyle81 authored Aug 13, 2019
1 parent b3588c1 commit 1dd3217
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion objectives/randomness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,6 @@ We can generalize this into an algorithm like so:
import random
def fisher_yates_shuffle(l):
for i in range(0, len(l)):
random_index = random.randint(0, len(l) - 1)
random_index = random.randint(i, len(l) - 1)
l[random_index], l[i] = l[i], l[random_index]
```

0 comments on commit 1dd3217

Please sign in to comment.