diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2010-07-27 08:18:25 -0600 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-07-28 10:07:23 +0200 |
commit | 83832992940e343002e924b1307988d2604ee165 (patch) | |
tree | 6ead241b56a400abd516361b20cf2236859d75c4 /opcode.pl | |
parent | 401a9b146916c60dc9bbd897355c3c83888d61f3 (diff) | |
download | perl-83832992940e343002e924b1307988d2604ee165.tar.gz |
srand: change to return its seed
This commit changes srand to to return the seed instead of always
returning 1. The motivation behind this is to allow applications to not
have to come up with their own pseudo-random generator if they want
repeatable results.
The previous return behavior has never been documented. Note that it is
possible, but very unlikely, for the seed to end up being 0, which means
that if someone were relying on the undocumented previous behavior of
srand returning true, that in very rare instances it would return 0,
failing, and the next time they ran it, it would succeed, possibly
leading to puzzlement and very rare unexplained failures.
Diffstat (limited to 'opcode.pl')
-rwxr-xr-x | opcode.pl | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -757,7 +757,7 @@ atan2 atan2 ck_fun fsT@ S S sin sin ck_fun fsTu% S? cos cos ck_fun fsTu% S? rand rand ck_fun sT% S? -srand srand ck_fun s% S? +srand srand ck_fun sT% S? exp exp ck_fun fsTu% S? log log ck_fun fsTu% S? sqrt sqrt ck_fun fsTu% S? |