#84
17th Nov 2018 at 2:58 AM
Last edited by kestrellyn : 17th Nov 2018 at
3:23 AM.
Posts: 3,805
Thanks: 9664 in 44 Posts
12 Achievements
Quote: Originally posted by Peni Griffin
The randomizers are still broken, and likely to remain so. Most randomizers in most programs are, I believe; because true randomness is not testable and programmers hate that.
|
It's perfectly possible to get numbers that are random enough for most purposes *and* testable. When you want the numbers to be random, you seed the random number generator with the current timestamp (which is guaranteed to be different each time you run the program, although it's not really unpredictable). When you want to test, you seed the random number generator with a constant that is the same from test to test and the "random" numbers will be the same every time. In practice, though, you usually don't test with an actual random number generator, generally you test by setting up a specific situation and test how a specific thing works in that situation. If your program/game is complicated enough that testing this way is not exhaustive enough, the best way to test is to have your QA team play the game/use the program and try to find ways to break it.
(Getting random numbers that are random enough to say, do cryptography with is a little harder but still not impossible. Even these random numbers are not "true" random numbers, but they are random enough for almost every purpose. The reason we don't have
true random numbers has nothing to do with testability and is just because that's a natural limitation of computers that behave in deterministic ways.)