From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c637b36a7fc5f587 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!26g2000yqk.googlegroups.com!not-for-mail From: jonathan Newsgroups: comp.lang.ada Subject: Re: Randomness tests Date: Fri, 17 Jul 2009 15:25:56 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7b474f8a-d108-43f3-ad80-47f1205bafe1@26g2000yqk.googlegroups.com> References: <398c0d14-6c77-44cc-b5f3-428f94102152@s31g2000yqs.googlegroups.com> NNTP-Posting-Host: 143.117.23.126 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247869556 1871 127.0.0.1 (17 Jul 2009 22:25:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 17 Jul 2009 22:25:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 26g2000yqk.googlegroups.com; posting-host=143.117.23.126; posting-account=Jzt5lQoAAAB4PhTgRLOPGuTLd_K1LY-C User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.11) Gecko/2009061208 Iceweasel/3.0.6 (Debian-3.0.6-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7120 Date: 2009-07-17T15:25:56-07:00 List-Id: On Jul 16, 8:41=A0pm, Gautier write-only 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} =3D X_n**2 mod M. The X_{n+1} =3D 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