class cv::RNG_MT19937

Overview

Mersenne Twister random number generator. Moreā€¦

#include <core.hpp>

class RNG_MT19937
{
public:
    // construction

    RNG_MT19937();
    RNG_MT19937(unsigned s);

    // methods

    unsigned
    next();

    operator double();
    operator float();
    operator unsigned();

    unsigned
    operator()(unsigned N);

    unsigned
    operator()();

    void
    seed(unsigned s);

    int
    uniform(
        int a,
        int b
        );

    float
    uniform(
        float a,
        float b
        );

    double
    uniform(
        double a,
        double b
        );
};

Detailed Documentation

Mersenne Twister random number generator.

Inspired by http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c Todo document

Methods

int
uniform(
    int a,
    int b
    )

returns uniformly distributed integer random number from [a,b) range

float
uniform(
    float a,
    float b
    )

returns uniformly distributed floating-point random number from [a,b) range

double
uniform(
    double a,
    double b
    )

returns uniformly distributed double-precision floating-point random number from [a,b) range