From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Seed for srandom() Date: Thu, 26 Dec 1996 18:30:17 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 25 Message-ID: <32C334B9.1A2@cs.com> References: <32c2339c DOT 566606 AT news DOT eunet DOT fi> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp218.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Aleksi Kallio wrote: > > What would be good seed function for srandom()? > Something clock based of course, but which one? > I didn't find any time function that returns int value. And srandom > requires int value. > Any good ideas? Cast the return value of time() to an int, like so: #include #include int main( void ) { srandom( (int) time( NULL ) ); ... } -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Plan: To find ANYONE willing to | http://www.cs.com/fighteer | | play Descent 2 on DWANGO! | Tagline: | ---------------------------------------------------------------------