Perl has a built-in random number generator, rand. Follow the link to its documentation.
use strict; use warnings; my @colors = qw (red yellow green cyan blue magenta white gray black); for (1 .. 10) { print $colors[rand(scalar(@colors))]; } __END__ $ perl -wl 637422.pl blue white gray cyan red green red black red red
In reply to Re: Creating a random generator
by andreas1234567
in thread Creating a random generator
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |