Rosella would like to have the ability to generate pseudo-random numbers without relying on C-level extensions or other external code. There are several important algorithms for generating pseudorandom numbers for various purposes, but one of the more versatile and famous is the Mersenne Twister. Rosella would like to have an implementation of this algorithm, but would like to provide a pluggable random number solution for applications that would prefer a different algorithm.
Provide an implementation of the Mersenne Twister algorithm, written in Winxed, for Rosella. Create a new file src/unstable/random/RandomNumber.winxed as a parent class to expose the general interface, and src/unstable/random/MersenneTwister.winxed as the subclass. Create the directory if necessary.
The random number generator system in general, and the Mersenne Twister implemenation specifically, should provide the following methods:
- void initialize(int seed)
- int get()
- float get_float()
- int get_range(int low, int high)
Please attempt to factor out as much reusable code as possible into the parent RandomNumber class.
Please add the new library to the Rosella build in setup.winxed. Follow existing examples for other unstable libraries for how to do this. Please create a small test/example program that shows random number generation. Add a file examples/mersenne.winxed for the example (create the directory if needed).
Steps To Complete This Task
- Create a fork of Rosella.git on github.com
- Implement the Mersenne Twister algorithm, and all all necessary files and classes.
- Add the new library files to the build in setup.winxed.
- Build Rosella to prove that the code compiles
- Add an example file to use your new library in examples/mersenne.winxed
- Create a Github pull request (button on the upper right of your fork) to have your changes incorporated into the master repository
- The ability to generate high-quality pseudo-random numbers without relying on external code or C libraries will help to make Rosella more portable and more dependable between platforms.
- Understanding of algorithms, especially pseudo-random number generation.
|File name/URL||File size||Date submitted|
|https://github.com/Whiteknight/Rosella/pul...||n/a||November 24 2011 01:59 UTC|
I would like to work on this task.
This task has been assigned to Nagato Yuki. You have 96 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
Congratulations, this task has been completed successfully.