Class to generate arrays of n integers chosen without replacement from [0,m-1]. More...
#include <mbl_random_n_from_m.h>
Public Member Functions | |
mbl_random_n_from_m () | |
Dflt ctor. | |
void | reseed (long new_seed) |
Set seed of random number generator. | |
void | choose_n_from_m (vcl_vector< unsigned > &chosen, unsigned int n, unsigned int m) |
Select n integers from range [0,m-1], without replacement. | |
void | choose_n_from_m (vcl_vector< unsigned > &chosen, vcl_vector< unsigned > ¬_chosen, unsigned int n, unsigned int m) |
Select n integers from range [0,m-1], without replacement. | |
void | choose_n_from_m (vcl_vector< int > &chosen, unsigned int n, unsigned int m) |
Select n integers from range [0,m-1], without replacement. | |
void | choose_n_from_m (vcl_vector< int > &chosen, vcl_vector< int > ¬_chosen, unsigned int n, unsigned int m) |
Select n integers from range [0,m-1], without replacement. | |
Private Attributes | |
vnl_random | mz_random_ |
vcl_vector< bool > | used_ |
Class to generate arrays of n integers chosen without replacement from [0,m-1].
Definition at line 12 of file mbl_random_n_from_m.h.
mbl_random_n_from_m::mbl_random_n_from_m | ( | ) |
Dflt ctor.
Definition at line 10 of file mbl_random_n_from_m.cxx.
void mbl_random_n_from_m::choose_n_from_m | ( | vcl_vector< unsigned > & | chosen, |
unsigned int | n, | ||
unsigned int | m | ||
) |
Select n integers from range [0,m-1], without replacement.
ie all different n is required to be <= m; otherwise, the function abort()s. But n might be 0, in which case an empty list is returned.
chosen | Array [0,n-1] of chosen elements |
Definition at line 20 of file mbl_random_n_from_m.cxx.
void mbl_random_n_from_m::choose_n_from_m | ( | vcl_vector< unsigned > & | chosen, |
vcl_vector< unsigned > & | not_chosen, | ||
unsigned int | n, | ||
unsigned int | m | ||
) |
Select n integers from range [0,m-1], without replacement.
ie all different n is required to be <= m; otherwise, the function abort()s. But n might be 0, in which case an empty list is returned.
chosen | Array [0,n-1] of chosen elements |
not_chosen | Array[0,m-n-1] of not chosen elements |
Definition at line 56 of file mbl_random_n_from_m.cxx.
void mbl_random_n_from_m::choose_n_from_m | ( | vcl_vector< int > & | chosen, |
unsigned int | n, | ||
unsigned int | m | ||
) |
Select n integers from range [0,m-1], without replacement.
ie all different n is required to be <= m; otherwise, the function abort()s. But n might be 0, in which case an empty list is returned.
chosen | Array [0,n-1] of chosen elements |
Definition at line 72 of file mbl_random_n_from_m.cxx.
void mbl_random_n_from_m::choose_n_from_m | ( | vcl_vector< int > & | chosen, |
vcl_vector< int > & | not_chosen, | ||
unsigned int | n, | ||
unsigned int | m | ||
) |
Select n integers from range [0,m-1], without replacement.
ie all different n is required to be <= m; otherwise, the function abort()s. But n might be 0, in which case an empty list is returned.
chosen | Array [0,n-1] of chosen elements |
not_chosen | Array[0,m-n-1] of not chosen elements |
Definition at line 108 of file mbl_random_n_from_m.cxx.
void mbl_random_n_from_m::reseed | ( | long | new_seed | ) |
Set seed of random number generator.
Definition at line 14 of file mbl_random_n_from_m.cxx.
vnl_random mbl_random_n_from_m::mz_random_ [private] |
Definition at line 15 of file mbl_random_n_from_m.h.
vcl_vector<bool> mbl_random_n_from_m::used_ [private] |
Definition at line 16 of file mbl_random_n_from_m.h.