delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/25/02:36:25

From: "Jason Jones" <tekREMOVETHIS AT quickbasic DOT com>
References: <7shlcr$bn2$1 AT canopus DOT cc DOT umanitoba DOT ca>
Subject: Re: srand()
Date: Fri, 24 Sep 1999 22:58:08 -0700
Lines: 21
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Message-ID: <eeVWtoxB$GA.320@cpmsnbbsa02>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Whenever I use srand() to seed the random number generator, I include time.h
and do this:

srand(time(0));

HTH,

--
Jason "Tek" Jones
tekREMOVETHIS AT quickbasic DOT com


Randy wrote in message <7shlcr$bn2$1 AT canopus DOT cc DOT umanitoba DOT ca>...
>To use rand() one should call srand() with a seed...
>Is there a really simple way to get the time?  Would I have to include
>time.h?
>
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019