www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/14/10:42:37

Date: Wed, 14 Aug 1996 14:20:45 -0300
Message-Id: <1.5.4.16.19960814113602.38473cb6@dmeasc.rc.ipt.br>
Mime-Version: 1.0
To: stwand07 AT uctvms DOT uct DOT ac DOT za, djgpp AT delorie DOT com
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Re: rand(), random() or libg++ Random ?

At 14:09 13/08/96 +0200, stwand07 AT uctvms DOT uct DOT ac DOT za wrote:
>Hi
>
>I am busy working on an optimisation program that makes extensive use of random
>number (stochastic search). I have been using srand(time(NULL)) and rand() to
>give random numbers in the range 0..1, which I then scale as required. I have
>heard that rand() is not very good, so my questions are :
>1. Is random() any better?
>2. Are the libg++ Random classes better?
>
>I need a normal distribution with zero mean, so 'better' refers to these
>criteria.
>
The rand and random functions will only give uniform distribution, in your
scaling process yuo'll have to "normalize" the distribution.

If you have more stringent requirements, you can consult D. Knuths books,
where he discusses those issues and offers a spectral test to check the
quality of random number generators.

>Adios
>Mark Wodrich.
>UCT, Cape Town, South Africa.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak                      E-mail: csrabak AT ipt DOT br
DME/ASC                                   Phone: 55-11-268-35221Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax:   55-11-268-5996
Av. Prof. Almeida Prado, 532.  Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Raw text -


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