From: Hawk AT DarkSoft DOT Net (^Hawk^) Newsgroups: comp.os.msdos.djgpp Subject: Re: (char) rand(); !? Date: Thu, 15 Apr 1999 20:39:08 +0200 Organization: DarkSoft-Productions Lines: 11 Message-ID: <3721322a.21999248@news.luebeck.netsurf.de> References: <37161bd0 DOT 16276943 AT news DOT luebeck DOT netsurf DOT de> <7f5bf8$h9k AT dfw-ixnews12 DOT ix DOT netcom DOT com> NNTP-Posting-Host: ppp142.luebeck.netsurf.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Keywords: DarkSoft, VGAP, Planets, Photo, Scan, Shop, Service, Host, Tools, Freeware, Shareware, VGA-Planets, Software, Hawk X-Newsreader: Forte Agent 1.5/32.451 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 15 Apr 1999 14:34:09 -0400, "Marp" wrote: >> Why does "dont_care[0]=(char) rand();" give me always the same output >> and how can I get _really_ random results !? >You must seed the rand() function at the start of your program to get >different results each time. At the start of your program put srand(time(0)) >You only need to have these functions called once. Read the documentation on >rand() and srand() in libc.inf. Great! Thanks alot! :-) Bye, ^Hawk^ - the DarkSoft-Productions @ www.darksoft.net