Update: Missed the unique criterion! Try this:my @num = map { int( 1 + rand 10 ) } (1..3);
my %num; while(keys %num < 3) { my $x = int( 1 + rand 10 ); $num{$x}++ unless exists $num{$x}; } my @num = keys %num;
-Mark
In reply to Re: Select three random numbers between 1..10
by kvale
in thread Select three random numbers between 1..10
by Perl_User
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |