OK, so you know about srand, after that the Perl command is pretty easy.

$A = int (rand (NUMBER))

This generates a random integer between 0 and NUMBER, including 0 but not
including number - e.g int (rand (5)) will give 0, 1, 2, 3 or 4.

'rand' generates a random number up to the value defined by NUMBER, and
'int' takes the integer value (drops everything right of the decimal point,
as you put it). 

Cheers

Mark C

P.S. The parentheses are optional


>Perhaps someone can give me a siple line
>in basic the rnd (random) Command goes something like this
>$A=fix(rnd*10)
>(the "fix" drops everything right of the decimal point. results in nnumber
0 to 9)
>what is it in perl? I've looked at perldoc.org, no luck
>and at the perldocs -f rnd... no luck
>what i'm trying to do is select a random graphic.gif for my website
backround.
>I know about srand;
>I'm new to perl, so be gentle and complete ;-)
>
>LH

Reply via email to