this will give you a random number of 0 or 1. Just substitue the 1 for the
number range you want.
Note: I have found that the lowest and highest numbers do not appear to
have the same randomness weighting as the middle range, probably due to the
sprintf rounding, so add two to the range you want
On Thu, Nov 22, 2001 at 10:04:24PM -0500, Andre` Niel Cameron wrote:
> Anyone know how to get a whole random number in perl?
>
> rand(18) always gives decimals I need just like 12 or 7 anyone know?
Multiply it by the maximum number you want, for example if you want
something between [1,20] you d
Andre-
How about simply multiplying by 10,100 or what ever you need then
dropping the remaining decimal
I.E. Int(100*rand(18));
Andre` Niel Cameron wrote:
>
> Hi,
>
> Anyone know how to get a whole random number in perl?
>
> rand(18) always gives decimals I need just like 12 or 7 anyone kno