diff options
author | 2015-07-16 15:19:55 +0000 | |
---|---|---|
committer | 2015-07-16 15:19:55 +0000 | |
commit | 093bca227a770c2992746c99d92e89b01fb08105 (patch) | |
tree | 511d915355d27f3655e892407ad83b6b824d6311 | |
parent | flower & bird adjustments for Nunavut, from pjanzen (diff) | |
download | wireguard-openbsd-093bca227a770c2992746c99d92e89b01fb08105.tar.xz wireguard-openbsd-093bca227a770c2992746c99d92e89b01fb08105.zip |
The expected behavior of Perl srand(0) is a deterministic pseudo
random stream. Only srand() should give real random values. Make
our pimped Perl more compatible with the rest of the world.
OK afresh1@ millert@
-rw-r--r-- | gnu/usr.bin/perl/pp.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gnu/usr.bin/perl/pp.c b/gnu/usr.bin/perl/pp.c index 79abdb01f89..7d26df9aa9c 100644 --- a/gnu/usr.bin/perl/pp.c +++ b/gnu/usr.bin/perl/pp.c @@ -2783,15 +2783,13 @@ PP(pp_srand) "Integer overflow in srand"); anum = UV_MAX; } + (void)srand48_deterministic((Rand_seed_t)anum); } else { - anum = 0; + anum = seed(); + (void)seedDrand01((Rand_seed_t)anum); } - if (anum) - (void)srand48_deterministic((Rand_seed_t)anum); - else - (void)seedDrand01((Rand_seed_t)anum); PL_srand_called = TRUE; if (anum) XPUSHu(anum); |