www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/24/03:41:34

From: mdruiter AT cs DOT vu DOT nl
Newsgroups: comp.os.msdos.djgpp
Subject: Re: randN
Date: Wed, 24 Nov 1999 08:14:07 GMT
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Lines: 28
Message-ID: <81g6of$i32@cs.vu.nl>
References: <383904BA DOT AE45DCDE AT mpx DOT com DOT au> <81bigt$1i5 AT acp3bf DOT knirsch DOT de>
NNTP-Posting-Host: galjas.cs.vu.nl
X-Sender: mdruiter AT cs DOT vu DOT nl
User-Agent: tin/pre-1.4-19990927 ("Nine While Nine") (UNIX) (SunOS/5.5.1 (sun4u))
X-Poster-Key: sha1:Qfe6/VBfiW1sCbjd7agqj9lCIms=
Cancel-Lock: sha1:YfWI11JcqsyENMDQxR2BgVnm65E=
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker <broeker AT acp3bf DOT knirsch DOT de> wrote:
> 'Other languages'; you're sure? I don't think I ever saw a programming
> *language* that has gaussian-distributed pseudo random numbers in its
> definition of 'must-have' library functions.

Maybe we can call Matlab a language? :)

>>     it is quite a common thing..has anyone thought about possibly
>> including functions like this in libm?

IIRC, some RNGs and several distributions are implemented in the
libg++ (libgpp in DJGPP) library which used to come with G++.

> The typical method works by transforming the distribution. The trick
> is that the cumulative version of any distribution is equally
> distributed between 0.0 and 1.0, i.e. you can randomly choose a
> 'percentile', and map that back to a value distributed as
> prescribed, by the inverse of the cumulative distribution function
> (the 'inverse error function', in the case of Gaussian).

Yes, or conversion from polar coordinates, as any book on this will
mention. The Gaussian inverse cdf is difficult to calculate.

-- 
Groeten, *Michel*       _http://www.cs.vu.nl/~mdruiter_
  ____________
  \  /====\  /          "You know, Beavis, you need things that suck,
   \/      \/            to have things that are cool", Butt-Head.

- Raw text -


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