delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/26/19:57:08

From: "Pavlos" <trash24379 AT usa DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Randomness - good enough for dice games?
Date: Sun, 27 Jun 1999 02:13:02 +0300
Organization: An OTEnet S.A. customer
Lines: 19
Message-ID: <7l3mpq$oha$1@newssrv.otenet.gr>
References: <7l3k1u$2f1$1 AT news101 DOT telia DOT com>
NNTP-Posting-Host: dram-a07.otenet.gr
X-Trace: newssrv.otenet.gr 930438778 25130 195.167.113.230 (26 Jun 1999 23:12:58 GMT)
X-Complaints-To: abuse AT otenet DOT gr
NNTP-Posting-Date: 26 Jun 1999 23:12:58 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jonas Kölker wrote in message <7l3k1u$2f1$1 AT news101 DOT telia DOT com>...
>Hi there!
>I'm needing some real good and very random functions, and I've tried the
>random(), but it just won't be random - always throws up the same result:
>
>/* !!!not compilable!!! */
>printf("%d",random()%100); //this always outputs 53 or something
>
>
>This makes me wonder - does random() need some initialization to be
random -
>as srand(clock()) for rand() - or won't it work proper on my machine?
>
>
For random(), you have to use srandom() as you use srand() for rand().



- Raw text -


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