Mersenne Twister Random Number Generator

Synopsis

Generate a random number

Results

Code

C++

#include "itkMersenneTwisterRandomVariateGenerator.h"

int
main(int, char *[])
{
  using GeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
  GeneratorType::Pointer generator = GeneratorType::New();

  generator->Initialize();

  std::cout << generator->GetUniformVariate(0, 5) << std::endl;

  return EXIT_SUCCESS;
}

Classes demonstrated