View Single Post

DataBeaver's Avatar


DataBeaver
02.12.2013 , 02:12 AM | #23
Quote: Originally Posted by Khevar View Post
Try to reduce the snark. You misread my statement. I said "implementing RNG is very easy"

The reason I said that is almost every programming language has a number of built-in rng functions. And if these are not adequate for your needs, there are a number of publicly available crypto rng functions which are much more robust, easily available and have a much less predictable pattern.
You are mixing up implementing an RNG with using it. It's easy to use an existing RNG to implement other algorithms that need randomness. However, implementing the RNG itself can be quite difficult.

There are some types that seem deceptively easy (LFSR and LCG come to mind), but they need careful selection of parameters or they'll produce very poor quality randomness. There are some others which involve more complex math but produce very high quality of randomness (like Mersenne twister). There are yet others that produce cryptographically secure random numbers but are computationally more expensive and thus unsuitable for high-throughput applications. A small error in the implementation of any RNG can significantly reduce its quality, so in most cases it's indeed best to use an existing implementation.