Randomness

Modern encryption techniques require the generation of random numbers on demand. This is a surprisingly hard problem.

Sophisticated attacks on encryption often rely on flaws in random number generators. For instance, many languages (including Python and Ruby) use the Mersenne Twister algorithm, which is not considered cryptographically secure. Randomness and cryptography are complex and deeply researched fields; it is generally a bad idea to roll your own encryption, unless you are sure you know what you are doing. If in doubt, make sure to use a standard and proven library, and keep on top of any security advisories.

Further Reading