tag 537952 patch thanks On Wed, 22 Jul 2009, Damyan Ivanov wrote: > I believe the patch Don is about to send will require smaller > changes. Having some conditional code would be nice so that it > doesn't break 5.8 installs, but that's it. Then we forward it > upstream and let them decide.
Attached is the fairly trivial change to do this; it's still not optimal, as it doesn't check to see if Perl_seed() exists, but it does in everything >= etch, so I'll leave that hackery to the upstream maintainer. $ for a in $(seq 1 50); do perl -MMath::Random=random_uniform -e 'print join(q( ), random_uniform(4)),qq(\n)'; done; 0.472561613734689 0.112694144518581 0.760243861293759 0.526104011907634 0.388301777190366 0.728964738530108 0.301970477061109 0.0450226752212864 0.535010305454897 0.540846363162594 0.533076974242713 0.881823355311055 0.0191560004038085 0.683769973982334 0.933477654282749 0.188419398393319 [...] Don Armstrong -- Nothing is as inevitable as a mistake whose time has come. -- Tussman's Law http://www.donarmstrong.com http://rzlab.ucr.edu
diff -u libmath-random-perl-0.71/debian/changelog libmath-random-perl-0.71/debian/changelog --- libmath-random-perl-0.71/debian/changelog +++ libmath-random-perl-0.71/debian/changelog @@ -1,3 +1,10 @@ +libmath-random-perl (0.71-1.1) unstable; urgency=low + + * Non-maintainer upload. + * new seedall XS function to seed using Perl_seed() (closes: #537952) + + -- Don Armstrong <[email protected]> Wed, 22 Jul 2009 02:46:31 -0700 + libmath-random-perl (0.71-1) unstable; urgency=low * Initial Release (Closes: #505182). --- libmath-random-perl-0.71.orig/Random.xs +++ libmath-random-perl-0.71/Random.xs @@ -210,6 +210,20 @@ setall(iseed1,iseed2); OUTPUT: +void +seedall () + PROTOTYPE: + CODE: +{ + /* For whatever reason, the random seeds need to be in 1..2^30; the + below will be uniformly distributed assuming the seed value is + uniformly distributed */ + setall((long)Perl_seed(aTHX) % 1073741824L, + (long)Perl_seed(aTHX) % 1073741824L + ); +} + OUTPUT: + double gvprfw (index) INPUT: --- libmath-random-perl-0.71.orig/Random.pm +++ libmath-random-perl-0.71/Random.pm @@ -73,7 +73,8 @@ ### set seeds by default -salfph(scalar(localtime())); +#salfph(scalar(localtime())); +seedall(); ##################################################################### # RANDOM DEVIATE GENERATORS #

