in reply to Re^2: Slightly Srandom JAPH
in thread Slightly Srandom JAPH
...I would expect srand JAPH to be the same thing as srand "JAPH", which should be the same thing as srand 0.
Since v5.14, srand returns the random number seed as well as setting it. So perl -e "print srand JAPH;" shows how JAPH is interpreted as a seed. On the perls I have to hand (all Strawberry Perl, except for v5.16.3, which is Citrus Perl), srand JAPH is the same as srand "JAPH", but in version 5.18 it is no longer the same as srand 0:
| perl | srand JAPH |
|---|---|
| 5.14.4 | 0 but true |
| 5.16.0 | 0 but true |
| 5.16.3 | 0 but true |
| 5.18.0 | 18446744073709551615 |
| 5.18.1 | 18446744073709551615 |
I haven’t found the reason for this. But the resulting warning was introduced in v5.18. From the “New Warnings” section of perl5180delta#New-Diagnostics:
"Integer overflow in srand" srand() now warns when passed a value that doesn't fit in a UV (since +the value will be truncated rather than overflowing) [perl #40605].
See also perldiag#Integer-overflow-in-srand.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Slightly Srandom JAPH
by Tux (Canon) on Dec 30, 2013 at 08:32 UTC |