Hacker News new | past | comments | ask | show | jobs | submit login

PCG generators are very good, very fast, and decently random, don't suffer (AFAIK) from bad seeds like Mersenne Twister, mix well, have small state, and have selectable periods of about any size. They are vastly better than LCGs.

I use a 64 bit one and a 128 bit one for all sorts of work.

These are not crypto, so don't use them for that. For non-crypto I have seen no better PRNG than these (and I've followed and written on this space for a long time).

Code available on github.

http://www.pcg-random.org/




When you say "not crypto, don't use them for that", you mean "don't use them for any situation in which the security of the randomness matters", right?


Yep - which is a lot, if not the vast majority, of random numbers generated.

Also, I'm answering a question by someone that looks like they want precisely this type of PRNG. There is no need to make a mess with CPRNGs.


That's exactly what I was looking for! Is it your code?


Not my code, but I have versions I've written for various platforms/languages that I use.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: