I humbly submit for my fellow monks' consideration a new CPAN module:
Math::Random::MT::Auto.
The module implements the
Mersenne Twister
which is the (current) quintessential pseudo-random number generator (PRNG).
It is fast, and has a period of 2^19937 - 1 (> 10^6000).
Key features:
This module culminates my long time interest
in PRNGs, and writing it gave me a chance to
explore the machinations of putting together a complete CPAN module. I put in the full effort to add a comprehensive POD, thorough testing and even a sample program giving comparative timing results.
This is my first submission to CPAN, and I would appreciate any feedback. (A review posted here
on PerlMonks would be fantastic. Any takers?)
UPDATE:
The terrific feedback from grinder, tlm, and others inspired me to go the whole
nine yards with this module. Version 4.00.00 features:
- Functional interface to a standalone PRNG
- Full-blown OO interface that uses the inside-out object model, and is thread-safe (Perl v5.7.2 and up).
- More than twice as fast as Math::Random::MT: under Windows, and more than four times faster under Solaris
- 64-bit int support for Perl compiled with 'use64bitint'
- Comprehensive subclass support including a working sample subclass for illustration
- Generalized random device support which also supports random seed data from files
- Support for user-supplied seeding functions
- Support for fetching and restoring PRNG state vector
- Win32 XP random seed source
- Integer and floating-point uniform random deviates
- Non-uniform deviates:
- Gaussian (normal)
- Exponential
- Erlang (gamma of integer order)
- Poisson
- Binomial
- A Fisher-Yates suffling function/method
- Numerous sample scripts
Remember: There's always one more bug.
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.