- rand
Returns a random fractional number greater than or equal to
0and less than the value of EXPR. (EXPR should be positive.) If EXPR is omitted, the value1is used. Currently EXPR with the value0is also special-cased as1- this has not been documented before perl 5.8.0 and is subject to change in future versions of perl. Automatically callssrandunlesssrandhas already been called. See alsosrand.Apply
int()to the value returned byrand()if you want random integers instead of random fractional numbers. For example,int(rand(10))
returns a random integer between
0and9, inclusive.(Note: If your rand function consistently returns numbers that are too large or too small, then your version of Perl was probably compiled with the wrong number of RANDBITS.)

