NXC RNG: Mersenne Twister

 

Here’s an example use of my implementation of the MT19937 Pseudo-Random Number Generator algorithm for NXC:

#include "MersenneTwister.h.nxc"
#include "random_ul.h.nxc"
#include "uniform_int.h.nxc"

#define MAX 10

task main()
{
    MT_srand();
    NumOut(0, 0, urand(MAX));
    Wait(2000);
}

The repository/sources can be found here.

 

~ by muntoo on July 22, 2011.

4 Responses to “NXC RNG: Mersenne Twister”

  1. First!
    Kidding.
    Hey, Uh, this is kinda off-topic, but…
    Hai, it’s me, 2Tie.
    I could possibly finish up my Mario engine…
    And I see that there’s another one (or two?) finished already, but…
    I kinda have the motivation to finish it now.
    Would you want me to?

  2. hi muntoo,
    where can I find the Mersenne Twister library?

Leave a comment