Random numbers



examples/scalars/random.pl
#!/usr/bin/perl
use strict;
use warnings;

my $num = rand();       # returns a random number: 0 <= NUMBER < 1
my $n   = rand(100);    # returns a number: 0 <= NUMBER < 100
my $i   = int(3.12);    # returns the whole part of the number (3 in this case)

my $number = int(rand(100)); # returns a whole number: 0 <= NUMBER < 100