On Thu 06 Mar, Andrew Green wrote:
> 
> In article <[EMAIL PROTECTED]>,
> kenwin charles <[EMAIL PROTECTED]> wrote:
> > 
> > is it possible you can assist me on how to generate random number
> > between the range -10 to 10.
> 
>     my $num = int(rand 21) - 10;

Yes, but please bear in mind that the RISC OS port of Perl does not
produce random numbers uniformly from the rand() function. There is
a bug in UnixLib upon which RISC OS Perl is dependent, that causes
the random number to be generated incorrectly. There was a thread of
discussion about the problem on this very mailing list a while back.
See the archives at:

http://www.mail-archive.com/riscos%40perl.org/msg00106.html

Random number generation is poorly understood by most people
and, in that thread, I seem to recall having quite a bit a
trouble convincing people to look at the facts. Hopefully,
we won't have that problem a second time round. :-)

-- 
James Taylor, Cheltenham, Gloucestershire, UK.       PGP key: 3FBE1BF9

Reply via email to