Public Types | Public Member Functions | Public Attributes
cv::RNG Class Reference

Random Number Generator. More...

#include <core.hpp>

List of all members.

Public Types

enum  { UNIFORM = 0, NORMAL = 1 }

Public Member Functions

 RNG ()
 RNG (uint64 state)
unsigned next ()
 updates the state and returns the next 32-bit unsigned integer random number
 operator uchar ()
 operator schar ()
 operator ushort ()
 operator short ()
 operator unsigned ()
unsigned operator() (unsigned N)
 returns a random integer sampled uniformly from [0, N).
unsigned operator() ()
 operator int ()
 operator float ()
 operator double ()
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
void fill (InputOutputArray mat, int distType, InputArray a, InputArray b, bool saturateRange=false)
double gaussian (double sigma)
 returns Gaussian random variate with mean zero.

Public Attributes

uint64 state

Detailed Description

Random Number Generator.

The class implements RNG using Multiply-with-Carry algorithm


Member Enumeration Documentation

anonymous enum
Enumerator:
UNIFORM 
NORMAL 

Constructor & Destructor Documentation

cv::RNG::RNG ( uint64  state)

Member Function Documentation

unsigned cv::RNG::next ( )

updates the state and returns the next 32-bit unsigned integer random number

cv::RNG::operator uchar ( )
cv::RNG::operator schar ( )
cv::RNG::operator ushort ( )
cv::RNG::operator short ( )
cv::RNG::operator unsigned ( )
unsigned cv::RNG::operator() ( unsigned  N)

returns a random integer sampled uniformly from [0, N).

unsigned cv::RNG::operator() ( )
cv::RNG::operator int ( )
cv::RNG::operator float ( )
cv::RNG::operator double ( )
int cv::RNG::uniform ( int  a,
int  b 
)

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

float cv::RNG::uniform ( float  a,
float  b 
)

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

double cv::RNG::uniform ( double  a,
double  b 
)

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

void cv::RNG::fill ( InputOutputArray  mat,
int  distType,
InputArray  a,
InputArray  b,
bool  saturateRange = false 
)
double cv::RNG::gaussian ( double  sigma)

returns Gaussian random variate with mean zero.


Member Data Documentation


The documentation for this class was generated from the following files: