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

My take is to never trust the built-in random number generator of any standard library. Get a copy of Numerical Recipes and implement your own, it's only a few lines of code.



why would you assume that the stdlib random number generator is worse than the few lines of code from numerical recipes?


At least then you know which one it is, what properties it has, and how it is initialized. Too few random number libraries document this. But as that is the primary advantage my gut would be to still at least use a library. It's not hard to come up with a Mersenne Twister library, and if you need something cryptographically secure just about the only thing I'd even consider is going straight to the OpenSSL implementation.


It's not that it's worse, it's the fact that is different for each platform.


it's a random number generator! you shouldn't be relying on any particular property other than that it passes the statistical tests for randomness.


You need to be able to re-create your inputs if a problem occurs. You need to be able to seed a random number generator and have it generate the same sequence for debugging.




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

Search: