delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/30/06:31:44

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Random implementation
Date: Thu, 29 Jan 1998 23:43:44 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 35
Message-ID: <34D15A80.62B5@cs.com>
References: <34CFD500 DOT 219A AT cs DOT com> <19980129234501 DOT SAA21413 AT ladder02 DOT news DOT aol DOT com>
NNTP-Posting-Host: ppp229.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Myknees wrote:
> 
> You are just seeing me trying out new things.  Is pc.h (getkey()) more portable
> than bios.h?

Not really, but you're probably more likely to find it on another DOS
compiler.  :-)  getch() is even more portable; nearly every DOS compiler
has a conio.h.  All forms of non-stdio interface are non-ANSI, however,
so you won't find any of those on a non-DOS compiler.  Feel free to use
whatever you want, of course, but your program is easier for others to
undertand if you use quasi-"standard" functions.  :-)

> Fair enough, but cross references are an easy enough shortcut if there isn't
> time for explanation.  And mentioning that rand() must be seeded hardly
> constitutes a tutorial.

You are absolutely right.  I'll check the docs before v2.02 is released
to be sure these made it in there.

> 
> --Ed (Myknees)
> 
> Here's how I see what you were talking about:

That's right.  Since the granularity of time() is usually one second,
any code that iterates more frequently than that will generate the
"same" random numbers.  :-)

-- 
---------------------------------------------------------------------
|      John M. Aldrich       |"A competent and self-confident person|
|       aka Fighteer I       | is incapable of jealousy in anything.|
|   mailto:fighteer AT cs DOT com   | Jealousy is invariably a symptom of  |
| http://www.cs.com/fighteer | neurotic insecurity."  - Lazarus Long|
---------------------------------------------------------------------

- Raw text -


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