We don't bite newbies here... much PerlMonks

### Re^5: how to get a 64bit random number with rand() ?

by sundialsvc4 (Abbot)
 on Mar 22, 2018 at 01:29 UTC ( #1211474=note: print w/replies, xml ) Need Help??

Thank you, “Mom.”   (I guess.)   All of you are quite correct in guessing that the previous post was mine – that I did not bother to log in before responding.   (But that I was making no particular attempt to hide myself ... why bother?)

Having both observed that a particular PRNG solution does not appear to provide 64 bits of entropy in an apparently 64-bit value, and having also expressed a concern with regards to this matter, it is quite reasonable to assume that the OP does require a more rigorous PRNG solution – perhaps, indeed, for some kind of cryptographic application.   As I noted, “several such PRNGs are available in the Perl environment.”

I would also like to specifically call-out the proffered suggestion of “simply” combining two 32-bit values.   From any cryptographic standpoint (or, from the standpoint of any other use-case requiring comparable rigor), this is n-o-t(!!) the same.   The two halves of the resulting 64-bit value will in fact be joined to one another:   one is the product of the PRNG at iteration (n), and the other is the product of that same PRNG at iteration (n+1), where the value of n is unpredictable but the relationship between the two parts is not.   This is a potentially-deadly flaw.   If you need n bits of entropy, you must use an algorithm that is designed to provide it.   Such algorithms are available in Perl.

• Comment on Re^5: how to get a 64bit random number with rand() ?

Replies are listed 'Best First'.
Re^6: how to get a 64bit random number with rand() ?
by Your Mother (Bishop) on Mar 23, 2018 at 00:01 UTC
(But that I was making no particular attempt to hide myself ... why bother?)

I dunno… Maybe because you are right now one node short of ruling the entire Worst Nodes page and already would if your frequent anonymous posts were included? You will in a matter of hours anyway unless someone steps up in the meantime to demand free code or defend you.

As to the rest. You have firmly and spectacularly demonstrated you are the last person in the monastery to trust on anything related to random numbers.

Log In?
 Username: Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1211474]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2020-01-25 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
The worst excuse I have ever heard is:

Results (110 votes). Check out past polls.

Notices?