itpp::I_Uniform_RNG Class Reference
Base Module » Random Number Generation

Integer uniform distribution. More...

`#include <itpp/base/random.h>`

## Public Member Functions

| I_Uniform_RNG (int min=0, int max=1)
| constructor. Sets min and max values.
void | setup (int min, int max)
| set min and max values
void | get_setup (int &min, int &max) const
| get the parameters
int | operator() ()
| Get one sample.
ivec | operator() (int n)
| Get a sample vector.
imat | operator() (int h, int w)
| Get a sample matrix.
int | sample ()
| Return a single value from this random generator.

## Detailed Description

Integer uniform distribution.

Example: Generation of random uniformly distributed integers in the interval [0,10].

#include "itpp/sigproc.h"
int main() {
I_Uniform_RNG gen(0, 10);
cout << gen() << endl; // prints a random integer
cout << gen(10) << endl; // prints 10 random integers
}
itpp::I_Uniform_RNG::I_Uniform_RNG
I_Uniform_RNG(int min=0, int max=1)
constructor. Sets min and max values.
Definition random.cpp:290

Definition at line 322 of file random.h.

## Constructor & Destructor Documentation

## I_Uniform_RNG()

itpp::I_Uniform_RNG::I_Uniform_RNG | ( | int | min = 0,
|  | int | max = 1 )

constructor. Sets min and max values.

Definition at line 290 of file random.cpp.

References itpp::max(), itpp::min(), and setup().

## Member Function Documentation

## setup()

void itpp::I_Uniform_RNG::setup | ( | int | min,
|  | int | max )

set min and max values

Definition at line 295 of file random.cpp.

References itpp::max(), and itpp::min().

Referenced by I_Uniform_RNG(), itpp::randi(), itpp::randi(), and itpp::randi().

## get_setup()

void itpp::I_Uniform_RNG::get_setup | ( | int & | min,
|  | int & | max ) const

get the parameters

Definition at line 307 of file random.cpp.

References itpp::max(), and itpp::min().

## operator()() [1/3]

int itpp::I_Uniform_RNG::operator() | ( |  | ) |

inline

Get one sample.

Definition at line 332 of file random.h.

References sample().

## operator()() [2/3]

ivec itpp::I_Uniform_RNG::operator() | ( | int | n | ) |

Get a sample vector.

Definition at line 313 of file random.cpp.

References sample().

## operator()() [3/3]

imat itpp::I_Uniform_RNG::operator() | ( | int | h,
|  | int | w )

Get a sample matrix.

Definition at line 323 of file random.cpp.

References sample().

## sample()

int itpp::I_Uniform_RNG::sample | ( |  | ) |

inline

Return a single value from this random generator.

Definition at line 338 of file random.h.

References itpp::floor_i().

Referenced by operator()(), operator()(), and operator()().

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

- itpp/base/random.h
- itpp/base/random.cpp

Generated on for IT++ by Doxygen 1.15.0