delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/27/10:18:49

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie Question: Random Numbers
Date: 27 Jul 1997 05:15:54 GMT
Organization: The National Capital FreeNet
Lines: 15
Message-ID: <5relia$3qd@freenet-news.carleton.ca>
References: <01bc9a61$57701640$204678c7 AT warren1>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet2.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

"Warren Smith" (gsmith AT netins DOT net) writes:
> How can I get a truly random number (w/o the same sequence of numbers
> appearing over and over)?

Seed the random generator using the system clock. The seeding functions
are srand for rand and srandom for random. There are a bunch of clock
functions, of which any that return integers and not structs should do,
for instance rawclock.

--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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