OpenCV  3.2.0-dev
Open Source Computer Vision
cvflann::UniqueRandom Class Reference

Random number generator that returns a distinct number from the [0,n) interval each time. More...

#include "random.h"

Public Member Functions

 UniqueRandom (int n)
 Constructor. More...
 
void init (int n)
 Initializes the number generator. More...
 
int next ()
 Return a distinct random integer in greater or equal to 0 and less than 'n' on each call. More...
 

Detailed Description

Random number generator that returns a distinct number from the [0,n) interval each time.

Constructor & Destructor Documentation

cvflann::UniqueRandom::UniqueRandom ( int  n)
inline

Constructor.

Parameters
nSize of the interval from which to generate
Returns

References init().

Here is the call graph for this function:

Member Function Documentation

void cvflann::UniqueRandom::init ( int  n)
inline

Initializes the number generator.

Parameters
nthe size of the interval from which to generate random numbers.

Referenced by UniqueRandom().

Here is the caller graph for this function:

int cvflann::UniqueRandom::next ( )
inline

Return a distinct random integer in greater or equal to 0 and less than 'n' on each call.

It should be called maximum 'n' times. Returns: a random integer

Referenced by cvflann::KMeansIndex< Distance >::chooseCentersRandom(), and cvflann::random_sample().

Here is the caller graph for this function:


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