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.

 

About these ads

~ 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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: