www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/05/18:24:20

From: Ross Litscher <Litscher DOT 1 AT osu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Random numbers/George
Date: Thu, 05 Jun 1997 12:26:29 -0400
Organization: The Ohio State University
Lines: 51
Message-ID: <3396E8B5.7AD@osu.edu>
References: <2 DOT 2 DOT 32 DOT 19970604162434 DOT 0069d50c AT gate> <3395B097 DOT 5077 AT cornell DOT edu> <33967eab DOT 25749893 AT supernews DOT scsn DOT net> <3396E2A0 DOT C57 AT cornell DOT edu>
Reply-To: Litscher DOT 1 AT osu DOT edu
NNTP-Posting-Host: s-100-225.resnet.ohio-state.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A. Sinan Unur wrote:
> 
> Chris wrote:
> >
> > Here is a bit of code from C for Dummies.  The book is terrible in
> > most parts, but this is a nice llittle thing it did.  It demonstrates
> > how to go about generating random numbers using the computers time.
> >
> 
> ok, given the reference, it should not be surprising that you do not
> know the difference between seeding a random number generator and the
> actual algorithm that generates the pseudo-random numbers. a random
> number generator is actually a deterministic algorithm. that is, if you
> give it the same seed, you will get the same sequence out of it each and
> every time. this is actually very desirable for scientific applications.
> however, when you are playing a game, you do not want your hero to start
> at the same corner all the time. so, seeding the rng eith the ticks
> serves the purpose of giving the rng a non-predetermined starting point
> every time, and produce a different series every time.
> 
> >
> > int rnd(int range);
> > int seedrnd(void);
> 
> what is the point of this? first, your declaration does not match the
> actual function. second, why do something that is essentially renaming a
> standard library function.
> 
> >
> > void main(void)
> 
> no. int main(void) or int main(int argc, char *argv[]).
> 
> > int rnd(int range)
> > {
> >         int r;
> >         r=rand()%range;
> >         return(r);
> > }
> >
> 
> the question is whether % preserves the 'statistical randomness' of the
> series generated by rand().
> 
> this has been answered in detail before. read those posts and, please,
> for do not quote any dummies book.
> 
>   -- Sinan.

You seem pretty harsh in your postings. almost to the point of admiring
them.

- Raw text -


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