Bug#537952: Use more random random seed than localtime

Don Armstrong don at debian.org
Tue Jul 21 23:03:48 UTC 2009


Package: libmath-random-perl
Severity: normal

Math::Random has its random number only based on localtime:

$ for a in $(seq 1 20); do perl -MMath::Random=random_uniform -e 'print join(q( ),random_uniform(4)),qq(\n)'; done;
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.489988645840918 0.579920159789368 0.993361818807086 0.955731167568429
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991
0.819419456017508 0.208303777363999 0.341532488367642 0.140379340821991

While Math::Random clearly isn't for cryptographic use, using such a
repeatable random seed isn't useful for non-cryptographic methods, and
shouldn't be the default on systems where there is a better
alternative.

It should instead call Perl_seed to generate the random number in XS.
I'll probably send in a patch in a bit which does this. [I probably
won't bother to make it compatible with pre 5.8 versions of perl which
don't have it, but that's not my problem.]


Don Armstrong

-- 
"A one-question geek test. If you get the joke, you're a geek: Seen on
a California license plate on a VW Beetle: 'FEATURE'..."
 -- Joshua D. Wachs - Natural Intelligence, Inc.

http://www.donarmstrong.com              http://rzlab.ucr.edu





More information about the pkg-perl-maintainers mailing list