From: jonathan <johnscpg@googlemail.com>
Subject: Re: Randomness tests
Date: Fri, 17 Jul 2009 15:25:56 -0700 (PDT)
Date: 2009-07-17T15:25:56-07:00 [thread overview]
Message-ID: <7b474f8a-d108-43f3-ad80-47f1205bafe1@26g2000yqk.googlegroups.com> (raw)
In-Reply-To: 398c0d14-6c77-44cc-b5f3-428f94102152@s31g2000yqs.googlegroups.com
On Jul 16, 8:41 pm, Gautier write-only <gautier_niou...@hotmail.com>
wrote:
> Does someone have some randomness checking sources in Ada ?
> I am evaluating a fast random generator (published long time ago in
> the Ada letters), alternative to GNAT's implementation.
> Probably the most obvious test is to check that it is well uniformly
> distributed.
> _________________________________________________________
> Gautier's Ada programming --http://sf.net/users/gdemont/
> NB: For a direct answer, e-mail address on the Web site!
You can find several basic tests at
http://web.am.qub.ac.uk/users/j.parker/miscellany
in the subdirectory: disorderly
see for example:
gcd_4bytes_1.adb
gcd_6bytes_1.adb
rank_tst_2.adb
bday_tst_1.adb
gorilla_tst_demo_2.adb
(To use gcd_6bytes_1.adb, concatenate 2 of the
24 bit words generated by Marsaglia's Universal
generator.)
The greatest-common-divisor test, gcd_6bytes_1.adb
and gorilla tests are from the Marsaglia,
Tsang updated diehard suite. To find their paper
google for
"Some difficult-to-pass tests of
randomness", Marsaglia, Tsang.
The birthday test is a variant of
Marsaglia's birthday test. I include
the birthday test (bday_tst_1.adb) because the
present GNAT generator fails this. (It has to.
All short period generators fail this test.)
I include Marsaglia's rank test (rank_tst_2.adb)
because it easily breaks the Mersenne Twister.
(It has to. The Mersenne Twister is full-period
and linear; they all fail this test catastrophically.)
I would still prefer the Mersenne Twister over
the Marsaglia Universal generator though .. it
does quite a bit more bit-mixing between outputs
than the Marsaglia Universal generator.
The site given above contains my own version of
the way I think Random Number Generators ought
to be done: disorderly.ads. Generator Disorderly
is really just a non-linear 61-bit version
of Marsaglia's KISS generator. KISS appeared
about a decade after his Universal generator.
The KISS generator is a combination generator
that uses linear component generators.
Disorderly includes a non-linear
component generator: X_{n+1} = X_n**2 mod M.
The X_{n+1} = X_n**2 mod M component in Disorderly
was inspired by GNAT's generator. The GNAT
generator is a combination generator made from
2 of these non-linear component generators.
(If you use just the least significant bit of
each word output by the GNAT generator, then
its called the Blum-Blum-Schub generator.)
A fast linear version of Disorderly is included;
seemed to be about 3 times faster than the GNAT
generator .. produces 61 bits per call.
Here is the start of the README:
1. directory Disorderly contains
a package of new Random Number Generators (package
Disorderly.Random) along with some test/demo
routines.
a package of Random Deviates (package
Disorderly.Random.Deviates) with the following distributions:
Uniform, Normal (Gaussian), Exponential, Lorentzian (Cauchy),
Poissonian, Binomial, Negative Binomial, Weibull, Rayleigh,
Student_t, Beta, Gamma, Chi_Squared, Log_Normal,
Multivariate_Normal.
procedure Deviates_Demo_1 tests
and demonstrates usage of random deviates (variates).
The procedure tests package Disorderly.Random.Deviates.
procedure Basic_Deviates_Demo_1 tests
and demonstrates usage of random deviates:
Disorderly.Basic_Rand.Deviates.
Uses Disorderly.Basic_Rand.
and demonstrates usage of random deviates (variates).
Jonathan
prev parent reply other threads:[~2009-07-17 22:25 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
2009-07-17 22:25 ` jonathan [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox