delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/30/08:34:16

From: Clemens Valens <c DOT valens AT mindless DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how about "more" random ?
Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
X-Originating-Host: 195.154.148.69
X-Wren-Trace: cDYRMSQ2ahk3f2IUJnp3bHRldmJpYCF6YGN5ZGZ7djZoaSN5aSN3dmtjan1uL2UieSw7NSRnEh46K3g7KXMxLX11ODI=
Message-ID: <933323259.1410@www.remarq.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990730091120 DOT 25172H-100000 AT is>
Lines: 15
Date: Fri, 30 Jul 1999 00:27:30 -0800
NNTP-Posting-Host: 10.0.3.195
X-Complaints-To: wrenabuse AT remarq DOT com
X-Trace: WReNphoon3 933323138 10.0.3.195 (Fri, 30 Jul 1999 01:25:38 PDT)
NNTP-Posting-Date: Fri, 30 Jul 1999 01:25:38 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I think the difference is due to limited wordlength, which
means rounding errors and overflow. For instance, when you
multiply by 100 before deviding, you can have an overflow.
For accurate calculations you should group together numbers
with the same order of magnitude. By dividing first you
reduce the output of rand to a value between 0 and 1 (if I
understand rand correctly) and then scale it to a number
between 0 and 100.

Clemens



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

- Raw text -


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