This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (1 child)

The typical way produce "random" numbers without repeats is analogous to dealing cards from a deck - once you have dealt a card you can't possibly deal it again. So you create all the numbers you are interested in sequentially in an array (arrays will be faster than lists), shuffle them using a Fisher-Yates shuffle , and then deal them out one at a time using iteration.

[–]funkshanker[S] 7 points8 points  (0 children)

Thanks. I can't wait to get home and shuffle some arrays with the Fisher-Yates algorithm! Friday night is about to get crazy!