From fanf@dotat.at  Wed Mar 14 00:24:35 2001
Return-Path: <fanf@dotat.at>
Received: from hand.dotat.at (sfo-gw.covalent.net [207.44.198.62])
	by hub.freebsd.org (Postfix) with ESMTP id B3B0E37B719
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 14 Mar 2001 00:24:34 -0800 (PST)
	(envelope-from fanf@dotat.at)
Received: from fanf by hand.dotat.at with local (Exim 3.20 #3)
	id 14d6aH-000EIY-00
	for FreeBSD-gnats-submit@freebsd.org; Wed, 14 Mar 2001 08:24:41 +0000
Message-Id: <E14d6aH-000EIY-00@hand.dotat.at>
Date: Wed, 14 Mar 2001 08:24:41 +0000
From: Tony Finch <dot@dotat.at>
Reply-To: Tony Finch <dot@dotat.at>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] make perl use a decent random number generator
X-Send-Pr-Version: 3.2

>Number:         25794
>Category:       gnu
>Synopsis:       [PATCH] make perl use a decent random number generator
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 14 00:30:01 PST 2001
>Closed-Date:    Mon Mar 28 13:04:30 GMT 2005
>Last-Modified:  Mon Mar 28 13:04:30 GMT 2005
>Originator:     Tony Finch <dot@dotat.at>
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Covalent Technologies, Inc.
>Environment:

FreeBSD hand.dotat.at 4.2-STABLE FreeBSD 4.2-STABLE #4: Wed Feb 21 00:26:12 GMT 2001     fanf@hand.dotat.at:/FreeBSD/obj/FreeBSD/releng4/sys/DELL-Latitude-CSx  i386

sources cvsupped Wed Mar 14 03:45:12 GMT 2001

>Description:

perl uses rand(3) as its random number generator, which is quite
frankly not the best of the bunch.

>How-To-Repeat:


>Fix:


Index: config.SH-elf.alpha
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/perl/libperl/config.SH-elf.alpha,v
retrieving revision 1.16.2.1
diff -u -r1.16.2.1 config.SH-elf.alpha
--- config.SH-elf.alpha	2000/10/31 08:05:27	1.16.2.1
+++ config.SH-elf.alpha	2001/03/14 08:20:42
@@ -585,8 +585,8 @@
 zip='zip'
 # Configure command line arguments.
 config_arg0='Configure'
-config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more'
-config_argc=10
+config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more -Dmy_rand=random -Dmy_sran=srandom'
+config_argc=12
 config_arg1='-Dprefix=/usr'
 config_arg2='-Darchlib=/usr/libdata/perl/5.00503/mach'
 config_arg3='-Dprivlib=/usr/libdata/perl/5.00503'
@@ -597,6 +597,8 @@
 config_arg8='-Ulocincpth='
 config_arg9='-Uloclibpth='
 config_arg10='-Dpager=/usr/bin/more'
+config_arg11='-Dmy_rand=random'
+config_arg12='-Dmy_srand=srandom'
 PATCHLEVEL=5
 SUBVERSION=3
 CONFIG=true
Index: config.SH-elf.i386
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/perl/libperl/config.SH-elf.i386,v
retrieving revision 1.15.2.1
diff -u -r1.15.2.1 config.SH-elf.i386
--- config.SH-elf.i386	2000/10/31 08:05:27	1.15.2.1
+++ config.SH-elf.i386	2001/03/14 03:17:27
@@ -585,8 +585,8 @@
 zip='zip'
 # Configure command line arguments.
 config_arg0='Configure'
-config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more'
-config_argc=10
+config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more -Dmy_rand=random -Dmy_sran=srandom'
+config_argc=12
 config_arg1='-Dprefix=/usr'
 config_arg2='-Darchlib=/usr/libdata/perl/5.00503/mach'
 config_arg3='-Dprivlib=/usr/libdata/perl/5.00503'
@@ -597,6 +597,8 @@
 config_arg8='-Ulocincpth='
 config_arg9='-Uloclibpth='
 config_arg10='-Dpager=/usr/bin/more'
+config_arg11='-Dmy_rand=random'
+config_arg12='-Dmy_srand=srandom'
 PATCHLEVEL=5
 SUBVERSION=3
 CONFIG=true
Index: config.SH-threads-elf.alpha
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/perl/libperl/config.SH-threads-elf.alpha,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 config.SH-threads-elf.alpha
--- config.SH-threads-elf.alpha	2000/10/31 08:05:27	1.2.2.1
+++ config.SH-threads-elf.alpha	2001/03/14 08:20:25
@@ -585,8 +585,8 @@
 zip='zip'
 # Configure command line arguments.
 config_arg0='Configure'
-config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more'
-config_argc=10
+config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more -Dmy_rand=random -Dmy_sran=srandom'
+config_argc=12
 config_arg1='-Dprefix=/usr'
 config_arg2='-Darchlib=/usr/libdata/perl/5.00503/mach'
 config_arg3='-Dprivlib=/usr/libdata/perl/5.00503'
@@ -597,6 +597,8 @@
 config_arg8='-Ulocincpth='
 config_arg9='-Uloclibpth='
 config_arg10='-Dpager=/usr/bin/more'
+config_arg11='-Dmy_rand=random'
+config_arg12='-Dmy_srand=srandom'
 PATCHLEVEL=5
 SUBVERSION=3
 CONFIG=true
Index: config.SH-threads-elf.i386
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/perl/libperl/config.SH-threads-elf.i386,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 config.SH-threads-elf.i386
--- config.SH-threads-elf.i386	2000/10/31 08:05:27	1.2.2.1
+++ config.SH-threads-elf.i386	2001/03/14 08:20:32
@@ -587,8 +587,8 @@
 zip='zip'
 # Configure command line arguments.
 config_arg0='Configure'
-config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more'
-config_argc=10
+config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more -Dmy_rand=random -Dmy_sran=srandom'
+config_argc=12
 config_arg1='-Dprefix=/usr'
 config_arg2='-Darchlib=/usr/libdata/perl/5.00503/mach'
 config_arg3='-Dprivlib=/usr/libdata/perl/5.00503'
@@ -599,6 +599,8 @@
 config_arg8='-Ulocincpth='
 config_arg9='-Uloclibpth='
 config_arg10='-Dpager=/usr/bin/more'
+config_arg11='-Dmy_rand=random'
+config_arg12='-Dmy_srand=srandom'
 PATCHLEVEL=5
 SUBVERSION=3
 CONFIG=true
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->markm 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Wed Mar 14 02:34:20 PST 2001 
Responsible-Changed-Why:  
This PR just screams "Mark!" (ie. it mentions both perl and random stuff ;-) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25794 

From: Alex Kapranoff <kapr@acm.org>
To: Tony Finch <dot@dotat.at>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: gnu/25794: [PATCH] make perl use a decent random number generator
Date: Wed, 14 Mar 2001 16:46:37 +0300

 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)?

From: Tony Finch <dot@dotat.at>
To: freebsd-gnats-submit@FreeBSD.org, dot@dotat.at
Cc:  
Subject: Re: gnu/25794: [PATCH] make perl use a decent random number generator
Date: Sun, 16 Dec 2001 09:27:51 +0000

 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:~
 :;
 
 
State-Changed-From-To: open->closed 
State-Changed-By: markm 
State-Changed-When: Mon Mar 28 13:03:02 GMT 2005 
State-Changed-Why:  
Sorry about the rather long delay. Best to do this via the PERL 
folks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25794 
>Unformatted:
