I have two questions here:
Please explain me the meaning of truly random number. I Read many articles but I was not able to understand the meaning.
Please explain me the code behind Rand() function in any language preferably c++
I have two questions here:
Please explain me the meaning of truly random number. I Read many articles but I was not able to understand the meaning.
Please explain me the code behind Rand() function in any language preferably c++
"The computer uses a function to calculate random numbers. That means: having the same seed, we get the same row of random numbers every time. Therefore pseudo random numbers." – Ralph M. Rickenbach
This causes the computer to read its clock to obtain the value for the seed automatically. Function time returns the number of seconds that have passed since midnight on January 1, 1970. This value is converted to an unsigned integer and used as the seed to the random number generator.
This is of course a simplification, more can be read online. Below are references.
References:
A short summary:
A true random number is a number you cannot calculate under any circumstances that is generated by some event, while a random number calculated by the Rand()
function is calculated.
There are multiple ways to calculate such a number, some being more complex than others.
See this question for more details on how it works in (objective- in this case) C.