Struct opencv::core::RNG [−][src]
pub struct RNG { /* fields omitted */ }
Expand description
Random Number Generator
Random number generator. It encapsulates the state (currently, a 64-bit integer) and has methods to return scalar random values and to fill arrays with random values. Currently it supports uniform and Gaussian (normal) distributions. The generator uses Multiply-With-Carry algorithm, introduced by G. Marsaglia ( http://en.wikipedia.org/wiki/Multiply-with-carry ). Gaussian-distribution random numbers are generated using the Ziggurat algorithm ( http://en.wikipedia.org/wiki/Ziggurat_algorithm ), introduced by G. Marsaglia and W. W. Tsang.
Implementations
constructor
These are the RNG constructors. The first form sets the state to some pre-defined value, equal to 2**32-1 in the current implementation. The second form sets the state to the specified value. If you passed state=0 , the constructor uses the above default value instead to avoid the singular random number sequence, consisting of all zeros.
constructor
These are the RNG constructors. The first form sets the state to some pre-defined value, equal to 2**32-1 in the current implementation. The second form sets the state to the specified value. If you passed state=0 , the constructor uses the above default value instead to avoid the singular random number sequence, consisting of all zeros.
Overloaded parameters
Parameters
- state: 64-bit value used to initialize the RNG.
Trait Implementations
The method updates the state using the MWC algorithm and returns the next 32-bit random number. Read more
Each of the methods updates the state using the MWC algorithm and returns the next random number of the specified type. In case of integer types, the returned number is from the available value range for the specified type. In case of floating-point types, the returned value is from [0,1) range. Read more
returns uniformly distributed integer random number from [a,b) range Read more
returns uniformly distributed integer random number from [a,b) range Read more
returns uniformly distributed integer random number from [a,b) range Read more
fn fill(
&mut self,
mat: &mut dyn ToInputOutputArray,
dist_type: i32,
a: &dyn ToInputArray,
b: &dyn ToInputArray,
saturate_range: bool
) -> Result<()>
fn fill(
&mut self,
mat: &mut dyn ToInputOutputArray,
dist_type: i32,
a: &dyn ToInputArray,
b: &dyn ToInputArray,
saturate_range: bool
) -> Result<()>
Fills arrays with random numbers. Read more