in reply to Re^2: How to not print the same random number
in thread How to not print the same random number

Not much of a hog. Storing the numbers already picked in a hash would be about as bad. (I'm not sure how many copies of the list the shuffle approach will end up having.)

But anyway, if you go with what I understand to be your idea of repeatedly generating random numbers until you find one not yet in a hash, you'll end up taking a very very long time finding the last few numbers if the limit is, say, 1000000.

  • Comment on Re^3: How to not print the same random number

Replies are listed 'Best First'.
Re^4: How to not print the same random number
by shotgunefx (Parson) on Mar 05, 2006 at 20:43 UTC
    Well, I suppose I should have been more clear. I would think for many applications, the number of numbers picked compared to the number range would be relatively small.

    So I guess the proper answer would be, "it depends".

    -Lee
    "To be civilized is to deny one's nature."