There’s a few different things going on.
First off, you do actually have true randomness. It was historically a problem, but modern CPUs do, in fact, have [true random number generators](https://en.wikipedia.org/wiki/RDRAND). One of the common sources of entropy (“randomness”) is thermal noise: CPU temperature will easly fluctuate by a degree or two within the span of a second, so the value of, say, the third decimal place in that number can be _anything_. It’s effectively true randomness. You can then use some cryptographic magic to “stretch” that little slice of randomness into a larger chunk of random numbers. That said, those things are, by their very nature, pretty damn opaque and it’s borderline impossible to verify the truth of their claims of randomness, so e.g. Linux has historically not really trusted RDRAND as a source of entropy.
Then you have pseudo-random number generators (PRNGs). They’re basically complex mathematical formulas that produce random-seeming numbers. Keyword is “seeming”: From a given starting value, they will always produce the same sequence of numbers (hence _pseudo_-random). If you’re not doing something security critical (say, if you’re writing a simulation of some sort), you have PRNGs optimised for speed. If you’re trying to do security related stuff (generating passwords is the obvious one, but random numbers are _very_ important in security), then you have cryptographically-secure PRNGs (CPRNGs). They’re slower, but produce results that are, statistically, more or less indistinguishable from true randomness.
Latest Answers