http://www.perlmonks.org?node_id=1007327


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

Rigging the shuffle to be identical on a given host is easy -- simply feed a fixed seed to srand before your first call to rand.

This makes variation between hosts easy by simply choosing a host-specific property as your seed -- perhaps a mangled hardware address?

#!/usr/bin/perl -w use strict; use 5.10.0; my ($eth) = `ifconfig` =~ /HWaddr (\S+)/; $eth =~ s/\W//g; { no warnings 'portable'; srand hex $eth; } say rand for 1 .. 10;

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.