logoalt Hacker News

aidenn0today at 5:51 AM1 replyview on HN

This is also an easy way to detect RNGs that are not truncated (i.e. return the entire state (or any 1-to-1 permutation of their entire state):

https://www.pcg-random.org/posts/birthday-test.html

Example:

Any RNG with a period 2**32 that can output every 32-bit value at least once must have zero collisions for the first 2**32 outputs, but we would expect to see about 100 collisions after just 200k outputs.


Replies

gblarggtoday at 10:43 AM

Such an RNG would be great for playing your 2^32 song collection, since you'd never hear the same song twice within a given time through.