The shuffle function in List::Util implements a Fisher-Yates shuffle, which ensures that the probability for each of the 10 numbers to end up in any of the 10 slots is exactly equal. Then you just pull any three numbers out of the resulting list.use List::Util qw(shuffle); my @random = ( shuffle 1 .. 10 )[ 0 .. 2 ];
Makeshifts last the longest.
In reply to Re: Select three random numbers between 1..10
by Aristotle
in thread Select three random numbers between 1..10
by Perl_User
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |