What is Random Number Generator?
Random number generation is a fundamental operation in computing, cryptography, statistics, and gaming. There are two broad categories: pseudo-random number generators (PRNGs), which produce sequences that appear random but are determined by a seed value, and cryptographically secure random number generators (CSPRNGs), which source entropy from hardware events and are suitable for security applications. The difference matters enormously: a PRNG like Math.random() is predictable once the seed is known, while a CSPRNG like the Web Crypto API's getRandomValues() is not. Uses for random number generation include lottery draws, statistical sampling, A/B test assignment, cryptographic key generation, simulation seeding, and randomized algorithms.