TODO: try with a different random number generator (i.e. more reliably uniform)
Unless the size of the array is approaching the period length of the PRNG, then the quality of the PRNG has little or no effect upon the quality of the shuffling.
Neither the quality of any given shuffle; nor the quality of successive shuffles; nor the quality of any group of shuffles.
I'm not going to try and explain that beyond saying it is the nature of modular arithmetic; but by way of evidence I offer this. The standard PRNG used in perl 5.10 on windows is the notorious MSC rand that has only 15-bits: 0-32767.
However, if you use F-Y to shuffle any size array with less that 32767 elements; no matter a how many times you do it (within the bounds of reasonable values: say a human lifetime) then you will not detect any bias using simple std deviations or other simple correlation tools.
Eg. Run this code with any $L < 32767, and any $N, and try to find some bias using your test and you will fail:
#! perl -slw use strict; use Data::Dump qw[ pp ]; our $N //= 1e6; our $L //= 50; my %counts; ++$counts{ int( rand $L ) } for 1 .. $N; pp \%counts;
C:\test>junk77 -L=5 -N=1e7 { "0" => 1999935, 1 => 2000440, 2 => 1999682, 3 => 2001882, 4 => 19980 +61 } C:\test>junk77 -L=5 -N=1e7 { "0" => 1999465, 1 => 2000290, 2 => 1999884, 3 => 1999629, 4 => 20007 +32 } C:\test>junk77 -L=5 -N=1e7 { "0" => 1999025, 1 => 1999024, 2 => 2000250, 3 => 1999085, 4 => 20026 +16 } C:\test>junk77 -L=5 -N=1e7 { "0" => 1999941, 1 => 2001174, 2 => 1998446, 3 => 1999105, 4 => 20013 +34 } C:\test>junk77 -L=5 -N=1e7 { "0" => 1998594, 1 => 1999564, 2 => 2002043, 3 => 2000208, 4 => 19995 +91 } C:\test>junk77 -L=5 -N=1e8 { "0" => 19998201, 1 => 20012390, 2 => 19994928, 3 => 19998284, 4 => 1 +9996197 } C:\test>junk77 -L=50 -N=1e7 { "0" => 199673, 1 => 200117, 2 => 199619, 3 => 200785, 4 => 199947, 5 => 201072, 6 => 200075, 7 => 200212, 8 => 200173, 9 => 200781, 10 => 199524, 11 => 200163, 12 => 199981, 13 => 200973, 14 => 200483, 15 => 199633, 16 => 199506, 17 => 200081, 18 => 199572, 19 => 200733, 20 => 198890, 21 => 200602, 22 => 199665, 23 => 199819, 24 => 199935, 25 => 199939, 26 => 199868, 27 => 199960, 28 => 199116, 29 => 199926, 30 => 200444, 31 => 200205, 32 => 199426, 33 => 199787, 34 => 199578, 35 => 199312, 36 => 200249, 37 => 199743, 38 => 201357, 39 => 200411, 40 => 200164, 41 => 200179, 42 => 199436, 43 => 199302, 44 => 200279, 45 => 199640, 46 => 199267, 47 => 199733, 48 => 199664, 49 => 201001, }
In reply to Re^2: Shuffling CODONS
by BrowserUk
in thread Shuffling CODONS
by WouterVG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |