Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: How likely is rand() to repeat?

by jettero (Monsignor)
on Mar 08, 2012 at 20:59 UTC ( #958535=note: print w/replies, xml ) Need Help??

in reply to How likely is rand() to repeat?

I think that's a binomial problem beyond that, it really depends on where your random numbers are coming from. Modern OSes have csrngs in them and, I suppose a few shitty bits of entropy from your mouse movements, if that works at all. Does yours? Does your CPU have one of those weird intel dual-frequency hrngs? Mine has a dedicated entropy generator, but crypto nerds are quick to point out you don't need them if you have a good csrng, just a couple good seed bits and you're fine.

I'd expect what you have to repeat eventually. Use a hash, say Digest::SHA1, and I'd expect that to be pretty damn random. Feed it the time, a rand() number, and some sequential number. I'd expect that to have a lot more bits of doesn't-repeat than your method, if only because 25 bytes isn't very many when I have databases with a few hundred thousand payment records in them. Ya know?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://958535]
[Tux]: when I set QT_IM_MODULE and GTK_IM_MODULE both to c<xim> and *unset* XMODIFIERS, all works fantastic
Tux => $HOME
[Tanktalus]: great, now I'm going to have to convert html codes to text for display... :)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2017-09-25 21:16 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (291 votes). Check out past polls.