[ILUG-BOM] random no generation issues

Philip S Tellis philip@[EMAIL-PROTECTED]
Thu Mar 13 10:02:35 IST 2003

On Wed, 12 Mar 2003, Manish Jethani wrote:

> Ok, I get the idea.  Use rand() instead, for portability.  And 
> you have to seed the random no. generator with, say, the current 
> time.  Seed it using srandom((unsigned) time(NULL)) before any 
> calls to random().

Althought that is what I do, someone once said that it's a bad idea to 
seed the random number generator with the system time.

> > or does someone have a better idea of generating random nos?
> Yes, read the manual for random(3), srandom(3), rand(3), etc.

Read Seminumerical Analysis by the Don.  It'll pass on some insights 
into the theory of random number generation.

Remember, all generated random numbers are just pseudo random.  If you 
really want a random number, stick your finger in the air, pick the 
molecule that lands in the very centre of the tip of your finger, and 
measure its vibration.  Ensure it stays at the centre of your finger at 
this point.


Woman on Street:	Sir, you are drunk; very, very drunk.
Winston Churchill:	Madame, you are ugly; very, very ugly.
			I shall be sober in the morning.

More information about the Linuxers mailing list