caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: Dan Stark <interlock.public@gmail.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] How does OCaml std test Random
Date: Wed, 2 Jul 2014 21:42:22 +0200	[thread overview]
Message-ID: <E23DF483-A7E0-48E0-8E91-5A98514447AA@inria.fr> (raw)
In-Reply-To: <CANQp=sT3a+1LynnsGfOhP0kF7K6B2-PN9A4YMqTci13j6G=fpg@mail.gmail.com>

Hi,
> I am looking at the source of Random module 
> 
> https://github.com/ocaml/ocaml/blob/master/stdlib/random.ml
> 
> I found that it is tested via chi-square test, here is the test code inside:
[...]
> From my knowledge, if I get a chi-square value, I should check it against a table with the degree of freedom and then decide whether the null hypothesis fails or not.
> 
> Why (r -. sr,   (r *. t /. n) -. n,   r +. sr) can be used to check? What's the theory behind? 

You'll have to ask someone who knows about statistics and random numbers. IIRC, we implemented this chisquare test by copying from some book (possibly Sedgewick's "Algorithms") and the criterion was taken from the same source.

In fact, I'm almost sure the test results included in the comments were not updated with the latest changes to the code.

You should also pay attention to the comment about the Diehard tests at the beginning of the file: these tests are much more thorough than chisquare, and the current version passes them all.

-- Damien


      reply	other threads:[~2014-07-02 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-29 11:11 Dan Stark
2014-07-02 19:42 ` Damien Doligez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E23DF483-A7E0-48E0-8E91-5A98514447AA@inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=interlock.public@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).