delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/02/21:45:32

From: flupke <schawat AT club-internet DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: rand(), random() !!!!!!!!!!!!!!!!!!!!!!!??????
Date: Thu, 02 Jul 1998 22:30:35 +0200
Organization: Grolier Interactive Europe
Lines: 22
Message-ID: <359BEDEB.9FE67919@club-internet.fr>
References: <1998070219214100 DOT PAA22119 AT ladder03 DOT news DOT aol DOT com>
NNTP-Posting-Host: 194.158.123.78
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


MalcolmJ7 wrote:

> how do i randomize these functions?
> every time i use them they give me the same numbers, in the same order.
> when I use srandom() this, still gives me same numbers, in the same order.
>
> isn't there a randomize() statement, like in turbo c?

As far as I know, the randomize() function in turbo C fills srandom with the
timer value :

#include <time.h>
#include <stdlib.h>

void randomize(void)
{
 srandom(time(0));
}


- Raw text -


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