This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #115928] Configure now selects our internal drand48()
authorTony Cook <tony@develop-help.com>
Mon, 9 Sep 2013 04:06:35 +0000 (14:06 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 13 Sep 2013 01:33:58 +0000 (11:33 +1000)
Configure
Cross/config.sh-arm-linux
Cross/config.sh-arm-linux-n770
NetWare/config.wc
uconfig.h
uconfig.sh
win32/config.ce
win32/config.gc
win32/config.vc

index 7976c13..74806ef 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -19489,26 +19489,7 @@ esac
 
 : How can we generate normalized random numbers ?
 echo " "
-echo "Looking for a random number function..." >&4
-case "$randfunc" in
-'')
-       if set drand48 val -f; eval $csym; $val; then
-               dflt="drand48"
-               echo "Good, found drand48()." >&4
-       elif set random val -f; eval $csym; $val; then
-               dflt="random"
-               echo "OK, found random()." >&4
-       else
-               dflt="rand"
-               echo "Yuck, looks like I have to use rand()." >&4
-       fi
-       echo " "
-       ;;
-*)
-       dflt="$randfunc"
-       ;;
-esac
-cont=true
+echo "Using our internal random number implementation..." >&4
 
 case "$ccflags" in
 *-Dmy_rand=*|*-Dmy_srand=*)
@@ -19519,103 +19500,11 @@ case "$ccflags" in
        ;;
 esac
 
-while $test "$cont"; do
-       rp="Use which function to generate random numbers?"
-       . ./myread
-       if $test "$ans" = "$dflt"; then
-               : null
-       else
-               randbits=''
-       fi
-       randfunc="$ans"
-       if set $ans val -f; eval $csym; $val; then
-               cont=''
-       else
-               dflt=y
-               rp="I cannot find function $ans. Use that name anyway?"
-               . ./myread
-               dflt=rand
-               case "$ans" in
-                       [yY]*) cont='';;
-               esac
-       fi
-       case "$cont" in
-       '')
-               case "$randfunc" in
-               drand48)
-                       drand01="drand48()"
-                       seedfunc="srand48"
-                       randbits=48
-                       randseedtype=long
-                       ;;
-               rand|random)
-                       case "$randbits" in
-                       '')
-echo "Checking to see how many bits your $randfunc() function produces..." >&4
-                               $cat >try.c <<EOCP
-#$i_unistd I_UNISTD
-#$i_stdlib I_STDLIB
-#include <stdio.h>
-#ifdef I_UNISTD
-#  include <unistd.h>
-#endif
-#ifdef I_STDLIB
-#  include <stdlib.h>
-#endif
-int main()
-{
-       int i;
-       unsigned long tmp;
-       unsigned long max = 0L;
-
-       for (i = 1000; i; i--) {
-               tmp = (unsigned long) $randfunc();
-               if (tmp > max) max = tmp;
-       }
-       for (i = 0; max; i++)
-               max /= 2;
-       printf("%d\n",i);
-}
-EOCP
-                               set try
-                               if eval $compile_ok; then
-                                       dflt=`try`
-                               else
-                                       dflt='?'
-                                       echo "(I can't seem to compile the test program...)"
-                               fi
-                               ;;
-                       *)
-                               dflt="$randbits"
-                               ;;
-                       esac
-                       rp="How many bits does your $randfunc() function produce?"
-                       . ./myread
-                       randbits="$ans"
-                       $rm_try
-                       drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
-                       seedfunc="s$randfunc"
-                       randseedtype=unsigned
-                       ;;
-               *)
-                       dflt="31"
-                       rp="How many bits does your $randfunc() function produce?"
-                       . ./myread
-                       randbits="$ans"
-                       seedfunc="s$randfunc"
-                       drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
-                       if set $seedfunc val -f; eval $csym; $val; then
-                               echo "(Using $seedfunc() to seed random generator)"
-                       else
-                               echo "(Warning: no $seedfunc() to seed random generator)"
-                               seedfunc=rand
-                       fi
-                       randseedtype=unsigned
-                       ;;
-               esac
-               ;;
-       esac
-done
+randfunc=Perl_drand48
+drand01="Perl_drand48()"
+seedfunc="Perl_drand48_init"
+randbits=48
+randseedtype=U32
 
 : Check how to flush
 echo " "
index fea06f1..07fc8d2 100644 (file)
@@ -556,7 +556,7 @@ direntrytype='struct dirent'
 dlext='so'
 dlsrc='dl_dlopen.xs'
 doublesize='8'
-drand01='drand48()'
+drand01='Perl_drand48()'
 drand48_r_proto='0'
 dtrace=''
 dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap attributes re threads threads/shared'
@@ -882,9 +882,9 @@ ptrsize='4'
 quadkind='3'
 quadtype='long long'
 randbits='48'
-randfunc='drand48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='long'
+randseedtype='U32'
 ranlib=':'
 rd_nodata='-1'
 readdir64_r_proto='0'
@@ -915,7 +915,7 @@ sched_yield='sched_yield()'
 scriptdir='/usr/bin'
 scriptdirexp='/usr/bin'
 sed='sed'
-seedfunc='srand48'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype='fd_set *'
 sendmail=''
index c3b8daf..e3ebe6a 100644 (file)
@@ -529,7 +529,7 @@ direntrytype='struct dirent'
 dlext='so'
 dlsrc='dl_dlopen.xs'
 doublesize='8'
-drand01='drand48()'
+drand01='Perl_drand48()'
 drand48_r_proto='0'
 dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap attributes re threads threads/shared'
 eagain='EAGAIN'
@@ -852,9 +852,9 @@ ptrsize='4'
 quadkind='3'
 quadtype='long long'
 randbits='48'
-randfunc='drand48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='long'
+randseedtype='U32'
 ranlib=':'
 rd_nodata='-1'
 readdir64_r_proto='0'
@@ -881,7 +881,7 @@ sched_yield='sched_yield()'
 scriptdir='/usr/bin'
 scriptdirexp='/usr/bin'
 sed='sed'
-seedfunc='srand48'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype='fd_set *'
 sendmail=''
index 1182d47..016748d 100644 (file)
@@ -547,7 +547,7 @@ direntrytype='DIR'
 dlext='nlm'
 dlsrc='dl_netware.xs'
 doublesize='8'
-drand01='(rand()/(double)((unsigned)1<<RANDBITS))'
+drand01='Perl_drand48()'
 drand48_r_proto='0'
 dtrace=''
 dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes'
@@ -854,10 +854,10 @@ prototype='define'
 ptrsize='4'
 quadkind='5'
 quadtype='__int64'
-randbits='15'
-randfunc='rand'
+randbits='48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='unsigned'
+randseedtype='U32'
 ranlib='rem'
 rd_nodata='-1'
 readdir64_r_proto='0'
@@ -887,7 +887,7 @@ sched_yield=''
 scriptdir='~INST_TOP~~INST_VER~\bin'
 scriptdirexp='~INST_TOP~~INST_VER~\bin'
 sed='sed'
-seedfunc='srand'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype='fd_set *'
 sendmail='blat'
index 3e206dd..1a59f23 100644 (file)
--- a/uconfig.h
+++ b/uconfig.h
  *     function used to generate normalized random numbers.
  *     Values include 15, 16, 31, and 48.
  */
-#define Drand01()              Perl_drand48()          /**/
-#define Rand_seed_t            U32             /**/
-#define seedDrand01(x) Perl_drand48_init((Rand_seed_t)x)       /**/
-#define RANDBITS               48              /**/
+#define Drand01()              Perl_drand48()                /**/
+#define Rand_seed_t            U32           /**/
+#define seedDrand01(x) Perl_drand48_init((Rand_seed_t)x)       /**/
+#define RANDBITS               48               /**/
 
 /* Select_fd_set_t:
  *     This symbol holds the type used for the 2nd, 3rd, and 4th
 #endif
 
 /* Generated from:
- * eea5809659d1cac397ca3a1a48f51bcb5bfc60eb2dca2ef00b9b2015ee87729a config_h.SH
- * 3dc6c26adfbf4f2e111d90b34d50e317e18555a76a270fbac2899d08a42f2fd1 uconfig.sh
+ * fd2554fe3bee85bee863afd558a83caa6c1a317e9a044639199eda0827db903e config_h.SH
+ * 2a46be0c2dea164ef0186898854f667c064d678c6927d13e926c1bb37d9d4d0e uconfig.sh
  * ex: set ro: */
index 374e65d..00f06d6 100644 (file)
@@ -491,7 +491,7 @@ db_version_patch='0'
 defvoidused=1
 direntrytype='struct dirent'
 doublesize='8'
-drand01="((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))"
+drand01="Perl_drand48()"
 drand48_r_proto='0'
 dtrace=''
 eagain='EAGAIN'
@@ -691,9 +691,9 @@ ptrsize='4'
 quadkind='4'
 quadtype='int64_t'
 randbits='48'
-randfunc='drand48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='int'
+randseedtype='U32'
 rd_nodata='-1'
 readdir64_r_proto='0'
 readdir_r_proto='0'
@@ -717,7 +717,7 @@ sSCNfldbl='"llf"'
 sched_yield='sched_yield()'
 scriptdir='/usr/local/bin'
 scriptdirexp='/usr/local/bin'
-seedfunc='srand'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype=int
 setgrent_r_proto='0'
index c3e3678..46c0673 100644 (file)
@@ -543,7 +543,7 @@ direntrytype='struct direct'
 dlext='dll'
 dlsrc='dl_win32.xs'
 doublesize='8'
-drand01='(rand()/(double)((unsigned)1<<RANDBITS))'
+drand01='Perl_drand48()'
 drand48_r_proto='0'
 dtrace=''
 dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes'
@@ -844,10 +844,10 @@ prototype='define'
 ptrsize='4'
 quadkind='5'
 quadtype='__int64'
-randbits='15'
-randfunc='rand'
+randbits='48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='unsigned'
+randseedtype='U32'
 ranlib='rem'
 rd_nodata='-1'
 readdir64_r_proto='0'
@@ -877,7 +877,7 @@ sched_yield=''
 scriptdir='~INST_TOP~~INST_VER~\bin'
 scriptdirexp='~INST_TOP~~INST_VER~\bin'
 sed='sed'
-seedfunc='srand'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype='Perl_fd_set *'
 sendmail='blat'
index ca098f3..d816795 100644 (file)
@@ -545,7 +545,7 @@ dlext='dll'
 dlltool='~ARCHPREFIX~dlltool'
 dlsrc='dl_win32.xs'
 doublesize='8'
-drand01='(rand()/(double)((unsigned)1<<RANDBITS))'
+drand01='Perl_drand48()'
 drand48_r_proto='0'
 dtrace=''
 dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes'
@@ -877,10 +877,10 @@ prototype='define'
 ptrsize='4'
 quadkind='3'
 quadtype='long long'
-randbits='15'
-randfunc='rand'
+randbits='48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='unsigned'
+randseedtype='U32'
 ranlib='rem'
 rd_nodata='-1'
 readdir64_r_proto='0'
@@ -912,7 +912,7 @@ sched_yield=''
 scriptdir='~INST_TOP~~INST_VER~\bin'
 scriptdirexp='~INST_TOP~~INST_VER~\bin'
 sed='sed'
-seedfunc='srand'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype='Perl_fd_set *'
 sendmail='blat'
index 829e0b4..fbfd7ce 100644 (file)
@@ -544,7 +544,7 @@ direntrytype='struct direct'
 dlext='dll'
 dlsrc='dl_win32.xs'
 doublesize='8'
-drand01='(rand()/(double)((unsigned)1<<RANDBITS))'
+drand01='Perl_drand48()'
 drand48_r_proto='0'
 dtrace=''
 dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes'
@@ -876,10 +876,10 @@ prototype='define'
 ptrsize='4'
 quadkind='5'
 quadtype='__int64'
-randbits='15'
-randfunc='rand'
+randbits='48'
+randfunc='Perl_drand48'
 random_r_proto='0'
-randseedtype='unsigned'
+randseedtype='U32'
 ranlib='rem'
 rd_nodata='-1'
 readdir64_r_proto='0'
@@ -911,7 +911,7 @@ sched_yield=''
 scriptdir='~INST_TOP~~INST_VER~\bin'
 scriptdirexp='~INST_TOP~~INST_VER~\bin'
 sed='sed'
-seedfunc='srand'
+seedfunc='Perl_drand48_init'
 selectminbits='32'
 selecttype='Perl_fd_set *'
 sendmail='blat'