The first (and easiest to understand) method of generating random numbers did indeed use a formula. Given the previously generated number `x`, a random seed `c`, a multiplier `a`, and a modulus m, you can compute a pseudorandom number as `(a * x + c) mod m`, where mod m means “divide by m and take the remainder”. See [https://en.wikipedia.org/wiki/Linear_congruential_generator](https://en.wikipedia.org/wiki/Linear_congruential_generator) for more details
Nowadays, we have more complex algorithms, but they’re a lot harder to understand without going really in depth. If you’re curious, wikipedia also has good explanations of them: [https://en.wikipedia.org/wiki/Mersenne_Twister](https://en.wikipedia.org/wiki/Mersenne_Twister), [https://en.wikipedia.org/wiki/Xorshift](https://en.wikipedia.org/wiki/Xorshift), [https://en.wikipedia.org/wiki/Well_equidistributed_long-period_linear](https://en.wikipedia.org/wiki/Well_equidistributed_long-period_linear)
Latest Answers