Yes, there are a whole lot of tests. The simplest test of randomness is to divide the range of the generator into buckets (let us say, 10, 100, or 1000 buckets), generate a lot of random numbers and plot how many generated numbers fall into each bucket. A good random generator will have approximately the same number of hits for each bucket (but so will a simple counter). Anyway, by the shape of the curve you can usualy make a pretty good guess about which distribution (if any) is being generated.
A very common test of randomness is the Chi square test, which you can find at Statistics::ChiSquare.
Knuth (the legend in computer science circles) wrote extensively on the subject of testing (and writing) pseudo-number generators in his seminal work "The Art of computer programming" (vol 2: seminumerical algorithms). You can also find a lot of algorithms here. However, they are in FORTRAN.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.