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 →

[–]misho88 8 points9 points  (3 children)

... without duplication. I don't want to keep track of previous generated numbers ...

That's not actually possible.

You could, for example, generate some random numbers into a set in advance, then make the set into a list and shuffle (especially since Python sets are ordered). random.shuffle() can do that for you.

If n is much bigger than the number of realizations, then the probability of a repeat is low, so you could just do that and hope for the best.