summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-07-16 15:19:56 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-07-16 15:19:56 +0000
commit7f2ff597f4b809b13e64b4b4747a3cd464fd9eea (patch)
tree2df8f5d4035d54a6631ec9df5832180776050a7e /gnu/usr.bin/perl
parent315e5790c0900b3236a72f6b9cfe3a54abf8bfc3 (diff)
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@
Diffstat (limited to 'gnu/usr.bin/perl')
-rw-r--r--gnu/usr.bin/perl/pp.c8
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);