in reply to Re: How to generate distinct random numbers?
in thread How to generate distinct random numbers?

That is not a fair algorithm. @avail shrinks during your loop, so the range rand(@avail) picks from does as well, and thus chances for any one number to be picked increase with each iteration.

Makeshifts last the longest.

  • Comment on Re^2: How to generate distinct random numbers?

Replies are listed 'Best First'.
Re^3: How to generate distinct random numbers?
by ysth (Canon) on Sep 07, 2004 at 06:05 UTC
    No.