On Thu, Oct 04, 2001 at 09:21:34PM +0800, Liu Tao wrote: > I use random() in my program to generate a random number, > but every time when I restart my program I get the same number. > How can I get different random numbers each time?
Look at srandom() to seed the generator. You can seed it with the current time, or with a couple of bytes from /dev/urandom, and so forth. -- John Patton [EMAIL PROTECTED] "They couldn't hit an elephant at this dist..." - General John B. Sedgwick Last words, 1864