Random Rationalized
I had a requirement to have random numbers generated in a C application.
#include <stdlib.h>
#include <stdio.h>
int main()
{
int i = 0;
for (i = 0; i < 5; i++) {
printf("Random number %d = %ld\n", i, random());
}
return 0;
}
I ran the code once and saw that random numbers were getting generated.
But to my surprise when I ran the code second time, I saw the same numbers getting printed.
What??? Does it mean random numbers are predictable? If so, why is it called random?
Random
andPredictable
words literally contradicting each other.
But I remember using random.random ...
more ...