#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. |
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 }
Definition at line 304 of file random.h.
itpp::I_Uniform_RNG::I_Uniform_RNG | ( | int | min = 0 , |
|
int | max = 1 | |||
) |
constructor. Sets min and max values.
Definition at line 148 of file random.cpp.
References setup().
void itpp::I_Uniform_RNG::setup | ( | int | min, | |
int | max | |||
) |
set min and max values
Definition at line 153 of file random.cpp.
Referenced by I_Uniform_RNG(), and itpp::randi().
void itpp::I_Uniform_RNG::get_setup | ( | int & | min, | |
int & | max | |||
) | const |
int itpp::I_Uniform_RNG::operator() | ( | ) | [inline] |
ivec itpp::I_Uniform_RNG::operator() | ( | int | n | ) |
imat itpp::I_Uniform_RNG::operator() | ( | int | h, | |
int | w | |||
) |
int itpp::I_Uniform_RNG::sample | ( | ) | [inline] |
Return a single value from this random generator.
Definition at line 319 of file random.h.
References itpp::floor_i(), and itpp::Random_Generator::random_01().
Referenced by operator()().
Generated on Fri Jun 8 02:09:03 2007 for IT++ by Doxygen 1.5.2