Mersenne Twister Seeding and UUIDs

Andrew Talbot andrew.talbot at talbotville.com
Wed Jun 13 13:12:21 PDT 2012


Regarding the mass production of random UUIDs, I believe that one would have 
to provide a seed that was at least 128 bits (or 16 ubyteS) wide in order to 
have uniform probability of generating any one random UUID from the entire 
set of 2^128 possible values. (If I read the following web page 
[http://randomlib.sourceforge.net/html/seeds.html] correctly, there would 
seem to be a strong probability of collisions when generating more than 2^16 
such UUIDs if only a 32-bit seed were used.)

In the same vein, when shuffling playing cards I reckon one would need a 
226-bit (or 29-ubyte) seed to cover the entire set of 52! (or approximately 
8 x 10^67) possible permutations. It may be that using even more bits is 
advisable.

I wish I understood PRNGs. I don't, but I think the above is true.

Thanks to everyone!

-- 
Andy.


More information about the Digitalmars-d mailing list