Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: How likely is rand() to repeat? (Mersenne)

by BrowserUk (Patriarch)
on Mar 09, 2012 at 18:03 UTC ( [id://958767]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How likely is rand() to repeat? (Mersenne)
in thread How likely is rand() to repeat?

"Just use a Mersenne Twister" doesn't solve the problem by itself.

There is no "problem" to solve.

The OP has stated that he needs less than a million IDs and is running on a 64-bit OS.

If he picks one starting point per run from the 2^64 that are possible -- using his built-in rand() or the MT19937-64 -- then he will be using 0.0000000000054210108624275221700372640043497% of the possibilities.

Another way: If he picks 1 new string, from a new starting position each time, every microsecond, he can expect a duplicate sometime in the next 50,000 years.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

  • Comment on Re^5: How likely is rand() to repeat? (Mersenne)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-25 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found