Had there been no System.Rando开发者_如何学运维m class, how would have you generated a random number?
Are there any known algorithms or have you guys ever designed one?
True random numbers can only be generated "outside" a computer, using radioactivity counts and such. Some VIA processors have hardware to do so.
Volume two of The Art of Computer Programming by Don Knuth spends a lot of time discussing exhaustively various pseudo-random number implementations from a mathematical background. Recommended reading.
You can't really generate a truly random number with our current deterministic computers. There are, however, many different ways to generate pseudorandom numbers. See pseudorandom number generator on wikipedia for some information on the algorithms.
Take a look at the Mersenne Twister. I belive this is the same algorithm implemented by System.Random, it is very common non cryptographically secure PRNG with a good random distribution.
Like the other answers say, its not possible to generate true random numbers with a computer, but as for pseudo-random, one algorithm that I've used before is the Linear Congruential Generator, its simple and fast, but I'm sure there are much better alternatives.
Edit: Grammar
精彩评论