| Newsgroups |
perl.cvs.perlfaq |
| Message-ID |
<[email protected]> |
cvsuser 02/09/04 15:32:20
Modified: . perlfaq4.pod
Log:
* Why aren't my random numbers random
showed a code snippet for setting srand at the beginning
of the script
Revision Changes Path
1.31 +4 -1 perlfaq/perlfaq4.pod
Index: perlfaq4.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -w -r1.30 -r1.31
--- perlfaq4.pod 25 Aug 2002 20:10:29 -0000 1.30
+++ perlfaq4.pod 4 Sep 2002 22:32:19 -0000 1.31
@@ -1,6 +1,6 @@
=head1 NAME
-perlfaq4 - Data Manipulation ($Revision: 1.30 $, $Date: 2002/08/25 20:10:29 $)
+perlfaq4 - Data Manipulation ($Revision: 1.31 $, $Date: 2002/09/04 22:32:19 $)
=head1 DESCRIPTION
@@ -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.