Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
laziness, impatience, and hubris
 
PerlMonks  

Re: How do I make a random shuffle deterministic?

by davido (Archbishop)
on Dec 05, 2012 at 16:37 UTC ( #1007328=note: print w/ replies, xml ) Need Help??


in reply to How do I make a random shuffle deterministic?

It seems that you should be able to seed using the integer representation of the host's IP address, or an integer representation of the characters from the hostname, and end up with stable results.

An aside: I was just reading this last night, for no good reason: Fisher Yates Shuffle: Pseudoraondom Generators: Problems involving state space, seeding, and usage. I'm not convinced that Perl's randomness generator is free from this issue, which would make your Fisher Yates shuffle (as well as the one included with List::Util suspect.

Hopefully someone can settle this concern. But reading Algorithm::Numerical::Shuffle's POD confirms that implementations using rand may have a flaw.


Dave


Comment on Re: How do I make a random shuffle deterministic?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007328]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-04-20 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls