[−][src]Struct opencv::core::RNG
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
impl RNG
[src]
pub fn as_raw_RNG(&self) -> *const c_void
[src]
pub fn as_raw_mut_RNG(&mut self) -> *mut c_void
[src]
impl RNG
[src]
pub fn default() -> Result<RNG>
[src]
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.
pub fn new(state: u64) -> Result<RNG>
[src]
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
impl Boxed for RNG
[src]
pub unsafe fn from_raw(ptr: *mut c_void) -> Self
[src]
pub fn into_raw(self) -> *mut c_void
[src]
pub fn as_raw(&self) -> *const c_void
[src]
pub fn as_raw_mut(&mut self) -> *mut c_void
[src]
impl Drop for RNG
[src]
impl RNGTrait for RNG
[src]
pub fn as_raw_RNG(&self) -> *const c_void
[src]
pub fn as_raw_mut_RNG(&mut self) -> *mut c_void
[src]
pub fn state(&self) -> u64
[src]
pub fn set_state(&mut self, val: u64)
[src]
pub fn next(&mut self) -> Result<u32>
[src]
pub fn to_u8(&mut self) -> Result<u8>
[src]
pub fn to_i8(&mut self) -> Result<i8>
[src]
pub fn to_u16(&mut self) -> Result<u16>
[src]
pub fn to_i16(&mut self) -> Result<i16>
[src]
pub fn to_u32(&mut self) -> Result<u32>
[src]
pub fn to_i32(&mut self) -> Result<i32>
[src]
pub fn to_f32(&mut self) -> Result<f32>
[src]
pub fn to_f64(&mut self) -> Result<f64>
[src]
pub fn uniform(&mut self, a: i32, b: i32) -> Result<i32>
[src]
pub fn uniform_1(&mut self, a: f32, b: f32) -> Result<f32>
[src]
pub fn uniform_2(&mut self, a: f64, b: f64) -> Result<f64>
[src]
pub fn fill(
&mut self,
mat: &mut dyn ToInputOutputArray,
dist_type: i32,
a: &dyn ToInputArray,
b: &dyn ToInputArray,
saturate_range: bool
) -> Result<()>
[src]
&mut self,
mat: &mut dyn ToInputOutputArray,
dist_type: i32,
a: &dyn ToInputArray,
b: &dyn ToInputArray,
saturate_range: bool
) -> Result<()>
pub fn gaussian(&mut self, sigma: f64) -> Result<f64>
[src]
impl Send for RNG
[src]
Auto Trait Implementations
impl RefUnwindSafe for RNG
[src]
impl !Sync for RNG
[src]
impl Unpin for RNG
[src]
impl UnwindSafe for RNG
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,