Front page | perl.perl5.porters |
Postings from October 2003
Re: 5.8.1 and srand
Thread Next
From:
Brendan O'Dea
Date:
October 2, 2003 00:43
Subject:
Re: 5.8.1 and srand
Message ID:
20031002003036.GA9198@londo.c47.org
On Wed, Oct 01, 2003 at 03:30:40PM -0400, Joey Hess wrote:
>Do you have any idea why perl 5.8.1 started seeding the RNG as soon as
>perl starts? This is very annoying for mooix, all methods run by mood get
>the same random seed unless I waste time calling srand at method run
>time.
This would appear to be an unexpected side-effect of the hash
randomisation introduced in 5.8.1 (see perldelta).
$ perl -le 'fork; print rand'
0.0327924393090768
0.0327924393090768
Perhaps we should not be setting PL_srand_called when the hash is
seeded.
--bod
--- util.c.orig 2003-09-09 06:43:13.000000000 +1000
+++ util.c 2003-10-02 10:22:28.000000000 +1000
@@ -4394,7 +4394,6 @@
{
/* Compute a random seed */
(void)seedDrand01((Rand_seed_t)seed());
- PL_srand_called = TRUE;
myseed = (UV)(Drand01() * (NV)UV_MAX);
#if RANDBITS < (UVSIZE * 8)
/* Since there are not enough randbits to to reach all
Thread Next
-
Re: 5.8.1 and srand
by Brendan O'Dea