in reply to A reproducible shuffle? ("stable shuffle")
#!/usr/bin/perl use strict; use warnings; use Digest::MD5 qw(md5); use Data::Dumper; my $salt='foo'; my @data = split('','abcdefghijklmnopqrstuvwxyz'); my @out = sort { md5($b.$salt) cmp md5($a.$salt) } @data; print "output ".Dumper(\@out);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A reproducible shuffle? ("stable shuffle")
by AK108 (Friar) on Feb 04, 2008 at 19:28 UTC |