From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: Random numbers? Date: 08 Dec 1999 21:10:27 -0800 Organization: InterWorld Communications Lines: 14 Message-ID: <83wvqo3dj0.fsf@mercury.st.hmc.edu> References: <384F1689 DOT B435CCDF AT localnet DOT com> NNTP-Posting-Host: mercury.st.hmc.edu X-Trace: nntp1.interworld.net 944716311 27395 134.173.45.219 (9 Dec 1999 05:11:51 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 9 Dec 1999 05:11:51 GMT X-Newsreader: Gnus v5.7/Emacs 20.4 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Mark Simmons writes: > How do I get a number that will be psuedo random? time(null) % max > doesn't work because the numbers need to be read in quick succession and > it simply produces a 1,2,3,4,5,6,7,8,9...0,1,2.... etc. pattern.. So, > how do I get a number that seems sort of random with a variable max? Read about `rand' in the documentation. Don't forget to `srand'; `time(NULL)' makes a good seed. -- Nate Eldredge neldredge AT hmc DOT edu