Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: How to generate distinct random numbers?

by Aristotle (Chancellor)
on Sep 06, 2004 at 23:31 UTC ( [id://388879] : note . print w/replies, xml ) Need Help??


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.