Can this even return anything else since 5.20? Consistent RNG
Looks like not - and thanks for pointing that out.
But the main thing is that $Config{randbits} accurately tells us just how many random bits there are in the values returned by rand().
And, on Strawberry Perl 5.38.2, that seems to be the case:
D:\>perl -MMath::MPFR=":mpfr" -le "for(1..10) { Rmpfr_dump(Math::MPFR-
+>new(rand())) }"
0.10111101010110010000010001100010101000100000001000000E-1
0.10101011001001100100100010110010011000110111100000000E0
0.11101100101010101111101111110010001010100010001100000E0
0.11110011010000100001010001110110110001011110010000000E-1
0.10101100000100111001001010001101000110100010101000000E-1
0.11101001110010110101101100100110111011111111110000000E0
0.10111011011010001000111110000000100101100101011100000E0
0.11110010000111110101011000001100010110100010110000000E-1
0.10000101100011000000001001101010111101100110100100000E0
0.11100110010000001010111101110010100000011000000000000E-1
Note that the last 5 bits are always 0.
The remaining question is: "How many random bits is random() providing ?"
Cheers,
Rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.