* Why aren't my random numbers random

   showed a code snippet for setting srand at the beginning
   of the script

Index: perlfaq4.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
retrieving revision 1.30
diff -u -d -r1.30 perlfaq4.pod
--- perlfaq4.pod        25 Aug 2002 20:10:29 -0000      1.30
+++ perlfaq4.pod        29 Aug 2002 03:43:50 -0000
@@ -334,6 +334,9 @@
 
 If you're using a version of Perl before 5.004, you must call C<srand>
 once at the start of your program to seed the random number generator.
+
+        BEGIN { srand() if $[ < 5.004 }
+
 5.004 and later automatically call C<srand> at the beginning.  Don't
 call C<srand> more than once---you make your numbers less random, rather
 than more.

Reply via email to