- or download this
sub shuffle
{
...
push @out, splice(@in, rand @in, 1) while @in;
@out;
}
- or download this
use strict;
...
push @out, splice(@in, rand @in, 1) while @in;
@out;
}
- or download this
Rate random_perm shuffle
random_perm 6000/s -- -30%
shuffle 8606/s 43% --