comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: Randomness tests
Date: Fri, 17 Jul 2009 13:41:03 -0700 (PDT)
Date: 2009-07-17T13:41:03-07:00	[thread overview]
Message-ID: <6cc86a34-4509-4b05-b8f4-39dabf18c06e@t13g2000yqt.googlegroups.com> (raw)
In-Reply-To: h3plgu$8c6$3@news.eternal-september.org

Nicholas Paul Collin Gloucester:

> Please let us know your conclusions.

So - the mentioned package is indeed the "universal" random generator
from Dr. George Marsaglia, which seems to have appeared in the Ada
letters in 1988, which circulates under the name U_Rand.
According to the machine and compiler, I get a speedup from 5x to 6.8x
(net of overhead).
No more advanced tests yet...
There are a couple of others generators I've to try, e.g. the Mersenne
Twister:
http://adrianhoe.com/adrianhoe/projects/adamt19937/
or a very simple one from Peter:
http://groups.google.ch/group/comp.lang.ada/msg/cf300f84f8782702

I've just "repimped" U_Rand with generics, no more global variables
but a type Generator, and some Ada 95 A.N.Float_Random-style
"renames", which facilitates the switch between random packages, like
in this example:

  -- *** Choice of the floating-point type used for the whole
Portfolio Model:
  subtype Real is Long_Float;

  package Real_U_Rand is new U_Rand(Real);

  -- *** Choice of a random generator: A.N.F_R, or U_Rand (faster),
or...:
  package RRand renames
    -- Ada.Numerics.Float_Random;
    Real_U_Rand;

The funny thing is that RRand can be plugged in its turn into another
generic package

  package GRA is new Ada.Numerics.Generic_Real_Arrays(Real);

  package RCopulas is new Copulas(
    Real,
    RRand.Uniformly_Distributed, RRand.Generator, RRand.Random,
    GRA
  );

In case someone is interested, mail me.
Anytime soon I'll open a SourceForge project with various random
variable goodies.
_________________________________________________________
Gautier's Ada programming -- http://sf.net/users/gdemont/
NB: For a direct answer, e-mail address on the Web site!



  reply	other threads:[~2009-07-17 20:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-16 19:41 Randomness tests Gautier write-only
2009-07-16 21:41 ` Jeffrey R. Carter
2009-07-17  1:53   ` Gautier write-only
2009-07-17  8:10 ` AdaMagica
2009-07-17 11:51   ` Peter Hermann
2009-07-17 19:05     ` AdaMagica
2009-07-17 10:58 ` Nicholas Paul Collin Gloucester
2009-07-17 20:41   ` Gautier write-only [this message]
2009-07-17 22:25 ` jonathan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox