Skip to content

A Mersenne Twister Pseudorandom Number Generator written in C++.

Notifications You must be signed in to change notification settings

begaret/MT19937

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

MT19937

A C++ implementation of the Mersenne Twister pseudorandom number generator based on the pseudocode on Wikipedia.

All coefficients are as according to the MT19937-32 standard.

Usage

The following program creates an instance of the generator seeded with the current time and then prints 100 random numbers.

#include <mt19937.h>
#include <iostream>
    
int main()
{
  MT19937 mt(time(NULL));
    
  for (int i = 0; i < 100; i++)
  {
    std::cout << mt.random() << std::endl;
  }
    
  return 0;
}

You can also use the seed_mt method to reset the seed.

About

A Mersenne Twister Pseudorandom Number Generator written in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages