Whenever I need a random number, I always use srand or some other simpe random number generator function.
I didn’t give a damn on how is it generated or how random the number is. That’s because, I just wanted a few random numbers(a few 100’s) and almost any decent algorithm can give me a random number within this range.
Now, I want to find a really good random number and I have a real need for it. The requirement is so strict that if the random number is not distributed fairly, I can easily notice that.
The challenge increases with the output range the user needs. There are pseudo random number generators(PRNG) which has a HUGE random number range, but it’s not distributed randomly.
Even I can give a dummy algorithm which will guarantee that I will not give out a number which I have already given out since past n requests.
I can write a simple program to answer your needs for fairly large n.
i=0; i+=1000 && i<n ; i++
This will 100% run until n, then start from i=1 and so on until 999.
But is it random? Depends on the need of the user.
This is 100% not random because it has an algorithm which predicts how to generate the next number and hence it’s not random.
I define random as something that’s unpredictable. I am in search for such a random number.
Truly random number generators should be definition should not be based on mathematics but shud be as a result of some natural events.
kernel random number generator picks such events and fills in it’s entropy tool to get various unrealted events and generates a random number based on that. But it’s too slow.
I want in the range of millions of numbers per second.
After days of searching on internet, i could find just 1 good random number genrator.
Thanks to the god of random number generator: “Dr. Marsaglia”. He has generated around 600 MB of almost true random numbers which he has given out in the website: http://stat.fsu.edu/pub/diehard/
This is failrly distributed and covers the entire range. Every bit in this file is random.
Hence any combination of bits you take should be random. So I am free to get any number size and my number is almost random.