http://www.perlmonks.org?node_id=1007633


in reply to Re^2: Random generator fail
in thread Random generator fail

Let's step through this:

foreach (1..100) { say rand($_); }
When $_ is equal to ...

Look at one of my earlier posts on this thread. The documentation for rand states that 0 <= rand($x) < $x if $x > 0. To accomplish what you are trying to do would require that you do this:

say 1 + rand(99 - 1) for (1..100)
In my previous node, MAX = 99 and MIN = 1. The 1..100 is the number of iterations you wish to use. If you use rand($_), your results will be biased toward the lower end of the counter range.

--MidLifeXis