QuantLib: MersenneTwisterUniformRng Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.20

Public Types | Public Member Functions | List of all members
MersenneTwisterUniformRng Class Reference

Uniform random number generator. More...

`#include <ql/math/randomnumbers/mt19937uniformrng.hpp>`

## Public Types
typedef Sample< Real > | sample_type

## Public Member Functions
| MersenneTwisterUniformRng (unsigned long seed=0)
| MersenneTwisterUniformRng (const std::vector< unsigned long > &seeds)
sample_type | next () const
Real | nextReal () const
| return a random number in the (0.0, 1.0)-interval
unsigned long | nextInt32 () const
| return a random integer in the [0,0xffffffff]-interval

## Detailed Description

Uniform random number generator.

Mersenne Twister random number generator of period 2**19937-1

For more details see http://www.math.keio.ac.jp/matumoto/emt.html

Tests:
  the correctness of the returned values is tested by checking them against known good results.

Examples
  GlobalOptimizer.cpp.

## Constructor & Destructor Documentation

## ◆ MersenneTwisterUniformRng()

MersenneTwisterUniformRng | ( | unsigned long | seed = `0` | ) |
| explicit

if the given seed is 0, a random seed will be chosen based on clock()

## Member Function Documentation

## ◆ next()

sample_type next | ( |  | ) | const

returns a sample with weight 1.0 containing a random number in the (0.0, 1.0) interval