Bug 25794

Summary: [PATCH] make perl use a decent random number generator
Product: Base System Reporter: Tony Finch <dot>
Component: gnuAssignee: Mark Murray <markm>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Tony Finch 2001-03-14 08:30:01 UTC
perl uses rand(3) as its random number generator, which is quite
frankly not the best of the bunch.
Comment 1 dwmalone freebsd_committer freebsd_triage 2001-03-14 10:34:20 UTC
Responsible Changed
From-To: freebsd-bugs->markm

This PR just screams "Mark!" (ie. it mentions both perl and random stuff ;-)
Comment 2 Alex Kapranoff 2001-03-14 13:46:37 UTC
On Wed, Mar 14, 2001 at 08:24:41AM +0000, Tony Finch wrote:
> >Category:       gnu
> >Synopsis:       [PATCH] make perl use a decent random number generator
> >Description:
> 
> perl uses rand(3) as its random number generator, which is quite
> frankly not the best of the bunch.

  Tony, I suppose you're mistaken. perl uses drand48(3) as a base for
its `rand' function under FreeBSD. This conclusion comes from
contrib/perl5/pp.c:1693 and libperl/config.h:2728 (the latter is
generated during the build from config.SH)

drand48 seems to be a good random generator.

> 
> >How-To-Repeat:

  How did you know perl uses rand(3)?
Comment 3 Tony Finch 2001-12-16 09:27:51 UTC
I am using -STABLE which has perl 5.005_03 not perl 5.6.

fanf@hand.dotat.at:~
:; perl -e 'print rand() * 2147483648 % 2  for (1..50); print "\n"'
01010101010101010101010101010101010101010101010101
fanf@hand.dotat.at:~
:;
Comment 4 Mark Murray freebsd_committer freebsd_triage 2005-03-28 14:03:02 UTC
State Changed
From-To: open->closed

Sorry about the rather long delay. Best to do this via the PERL 
folks.