# Thread: How can I get a REAL RANDOM number?

1. ## How can I get a REAL RANDOM number?

Hello, guys:

How could I ger a REAL RANDOM NUMBER in C Programming?
Don't ask me to call the rand(), it is not Real-Random, it is fake!
If possible, please write down the source code.
Thank you very much!
CAUTION: Real-Random means generate one number in certain range everytime without any regulation!!

2. A computer cannot think for itself. How can you tell a computer to pick a REAL random number. The best you will ever get is a pseudo-random number. You can vary the sequence of pseudorandom numbers produced by the rand() function by using srand() and seeding the generator with a different seed. If you are still insistent on going mad trying to do this then take a look at donald knuths art of computer programming vol.2 where he devotes a whole chapter to this problem.

3. here is a really nice random number generator thats 4 time faster than rand and much more random...

http://www.math.keio.ac.jp/~matumoto/emt.html

4. Hi!

If you are using linux, you could read "/dev/random" to get highly random numbers. But this can be quite slow (it is based on things like keyboard interrupts mouse interrupts, and network traffic; you can guess when it gets slow). But it's great for seeding good-quality pseudo-random generators!

There's also a quicker version, called "/dev/urandom". This is based on the same principles as the generator of the url given by no-one, but it is reseeded regularly when there is enough data in the "/dev/random" pool.

Some intel-chipsets have a built-in random number generator. (NOT kidding!).

greetinx,
alex

5. You can write a program which does make random numbers based on keyboard inputs (with getch()).

You can make your normal random generator have a wider range:

(randomnumber*randomnumber*maxnumber)%maxvalue+1

klausi