in reply to Select three random numbers between 1..10
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.
|
|---|