Random - Ruby classes for pseudorandom number generation
This package contains Random, a ruby extension adding classes for generating pseudorandom number generation (PRNG).
Random has the following features:
-
A fast PRNG implemented in C and wrapped in a Ruby class. The algorithm is the well-known and widely used MersenneTwister.
-
Multiple independent random streams can be active at the same time (since the PRNG is wrapped in a class and objects of that class are independent).
-
PRNG objects supports marshaling.
This is in contrast to Ruby’s standard srand/rand methods. Even though the standard methods use the same PRNG algorithm (the MersenneTwister) only a single (global) PRNG exists for each ruby invocation and its state cannot be saved to disc. Random alleviates these problems. This is especially important for scientific and simulation applications.
Download
The latest version of Random can be found at
Installation
GEM Installation
Download and install Random with the following.
gem install --remote random
Running the Random Test Suite
Random comes with an extensive test suite. If you wish to run it:
-
CD into the top project directory of random.
-
Type:
rake # If you have a version of rake installed
Online Resources and References
-
Documentation Home: coming!
-
Project Page: rubyforge.org/projects/random
-
API Documents: coming!
Simple Example
Once installed, you can use random as follows:
:include: doc/simple_example.rb
Credits
- Richard Wagner
-
For the C++ implementation of the MersenneTwister which is the basis for Random::MersenneTwister.
License
Random is available under a BSD-style license.
:include: LICENSE
Support
The Random homepage is random.rubyforge.org. You can find the Random RubyForge page at rubyforge.org/projects/random.
Feel free to submit commits or feature requests. If you send a patch, please also update and send the corresponding unit tests.
It would be great to get help with creating pre-compiled gems of this to simplify for users that do not have a build environment. Please email if you can help with this (especially for non-linux targets).
For other information, feel free to ask on the ruby-talk mailing list (which is mirrored to comp.lang.ruby) or contact [email protected].
Other stuff
- Author
-
Robert Feldt <[email protected]>
- Requires
-
Ruby 1.8.2 or later (but only tested with 1.8.4)
- License
-
Copyright 2006 by Robert Feldt Released under a BSD-style license. See the LICENSE file included in the distribution.