Logged-In As
ACCOUNT
Not Logged In
Implement Mersenne Twister Algorithm in Winxed for Rosella Parrot Foundation
Status: Closed Time to complete: 96 hrs Mentors: Andrew Whitworth Tags: Parrot,Winxed,Rosella,Algorithm

Task Description

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

  1. Create a fork of Rosella.git on github.com
  2. Implement the Mersenne Twister algorithm, and all all necessary files and classes.
  3. Add the new library files to the build in setup.winxed.
  4. Build Rosella to prove that the code compiles
  5. Add an example file to use your new library in examples/mersenne.winxed
  6. Create a Github pull request (button on the upper right of your fork) to have your changes incorporated into the master repository

Benefits

  1. 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.

Requirements

  1. Understanding of algorithms, especially pseudo-random number generation.
  2. Ability to program Winxed (or similar languages such as C, C++, C#, Java or JavaScript)

Additional Links

Uploaded Work
File name/URL File size Date submitted
https://github.com/Whiteknight/Rosella/pul... n/a November 24 2011 01:59 UTC
Comments
Nagato Yuki on November 24 2011 01:51 UTC Task Claimed

I would like to work on this task.

Andrew Whitworth on November 24 2011 01:58 UTC Task Assigned

This task has been assigned to Nagato Yuki. You have 96 hours to complete this task, good luck!

Nagato Yuki on November 24 2011 02:46 UTC Ready for review

The work on this task is ready to be reviewed.

Duke Leto on November 24 2011 03:34 UTC Task Closed

Congratulations, this task has been completed successfully.