in reply to Re^2: Random generator fail
in thread Random generator fail
Let's step through this:
When $_ is equal to ...foreach (1..100) { say rand($_); }
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:
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.say 1 + rand(99 - 1) for (1..100)
--MidLifeXis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Random generator fail
by Anonymous Monk on Dec 06, 2012 at 20:12 UTC |