Change 11859 by jhi@alpha on 2001/09/04 12:44:29
Subject: Re: A slightly better default seed?
From: Michael G Schwern <[EMAIL PROTECTED]>
Date: Mon, 3 Sep 2001 18:08:15 -0400
Message-ID: <20010903180815.W9233@blackrider>
Affected files ...
... //depot/perl/t/op/srand.t#3 edit
Differences ...
==== //depot/perl/t/op/srand.t#3 (text) ====
Index: perl/t/op/srand.t
--- perl/t/op/srand.t.~1~ Tue Sep 4 07:00:05 2001
+++ perl/t/op/srand.t Tue Sep 4 07:00:05 2001
@@ -3,7 +3,7 @@
# Test srand.
use strict;
-use Test::More tests => 3;
+use Test::More tests => 4;
# Generate a load of random numbers.
# int() avoids possible floating point error.
@@ -31,6 +31,19 @@
'srand(), different arg, different rands' );
+# Check that srand() isn't affected by $_
+{
+ local $_ = 42;
+ srand();
+ @first_run = mk_rand;
+
+ srand(42);
+ @second_run = mk_rand;
+
+ ok( !eq_array(\@first_run, \@second_run),
+ 'srand(), no arg, not affected by $_');
+}
+
# This test checks whether Perl called srand for you.
@first_run = `$^X -le "print int rand 100 for 1..100"`;
@second_run = `$^X -le "print int rand 100 for 1..100"`;
End of Patch.