...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:

perlsrand JAPH
5.14.40 but true
5.16.00 but true
5.16.30 but true
5.18.018446744073709551615
5.18.118446744073709551615

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,


In reply to Re^3: Slightly Srandom JAPH by Athanasius
in thread Slightly Srandom JAPH by BenGoldberg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.