in reply to A reproducible shuffle? ("stable shuffle")
A "stable shuffle" is just an arbitrary arrangement that doesn't change. So, why not just produce one and then embed it in the script(s) that requires it. Using your example above:
C:\test>perl -MList::Util=shuffle -wle"print join ' ', shuffle 'A'..'Z +'" Q I X H L R B C F E U M A S W J P K T O V N Y D G Z
And then just c&p that into your code:
... my @arr = qw[ Q I X H L R B C F E U M A S W J P K T O V N Y D G Z ]; ...
There you have a "stable shuffle" that stays stable until you change it. Without messing around with storing it in a DB or file.
(I also find your reasoning for not using srand inexplicable, but that's been said, and this is simpler:)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A reproducible shuffle? ("stable shuffle")
by AK108 (Friar) on Feb 04, 2008 at 17:47 UTC |