in reply to Re^3: Pick k numbers at random -- hash keys
in thread Pick k numbers at random
For small hashes, ordering isn't necessarily "random" from one hash to the next:
Same results under ActiveState 5.8.9 and Strawberry 5.14.4.1.c:\@Work\Perl\monks>perl -wMstrict -le "for (1 .. 8) { my @k = keys %{ { map { $_ => 1 } 0 .. 8 } }; print qq{@k}; } " 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5 6 3 7 2 8 1 4 0 5
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Pick k numbers at random -- hash keys
by syphilis (Archbishop) on Nov 13, 2019 at 01:06 UTC | |
by Discipulus (Canon) on Nov 13, 2019 at 08:52 UTC | |
by choroba (Cardinal) on Nov 13, 2019 at 15:55 UTC |