class cvflann::UniqueRandom

Overview

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

#include <random.h>

class UniqueRandom
{
public:
    // construction

    UniqueRandom(int n);

    // methods

    void
    init(int n);

    int
    next();
};

Detailed Documentation

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

Construction

UniqueRandom(int n)

Constructor.

Parameters:

n Size of the interval from which to generate

Returns:

Methods

void
init(int n)

Initializes the number generator.

Parameters:

n the size of the interval from which to generate random numbers.
int
next()

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