0

please tell what are truly random and pseudo random numbers.. how to generate either?

11th Jul 2016, 5:13 AM
Sarthak Saxena
Sarthak Saxena - avatar
3 Respuestas
+ 4
Pseudo-random numbers are, as the name suggests, not really random. Pseudo-random numbers are generated in a deterministic way and can therefore be predicted, if you know parameter details of how they are generated (pseudo-random numbers are generated by functions as rand()). Truly random numbers cannot be predicted. Computers usually only provide pseudo-random numbers via a random number generator. The most commonly used pseudo-random number generator sort are "Linear Congruential Generators" (LCGs, there's a Wikipedia article about this). For truly random numbers there are extension cards that use the random nature of atomic decay to generate their numbers.
11th Jul 2016, 8:09 AM
Stefan
Stefan - avatar
0
You can use srand(), to set a seed for randomizing function and to make them completely random you can use your current computer time as a seed
13th Jul 2016, 8:45 AM
Aiden
0
@Aiden: The current time is a parameter you can guess... you just need to know the computer is synchronized with a time service in the Internet and, assume the srand() initialization on the seconds since 1970 has happened in the last 100 seconds. Guessing afterwards will still be a bit of trial and error. Guessing truly random numbers I'd atm impossible. They don't need a seed you can guess.
13th Jul 2016, 10:02 AM
Stefan
Stefan - avatar