pub struct RandomEngine { /* private fields */ }
Expand description
Random number generator engine
This is a wrapper for ArrayFire’s native random number generator engine.
§Sharing Across Threads
While sharing this object with other threads, there is no need to wrap this in an Arc object unless only one such object is required to exist. The reason being that ArrayFire’s internal details that are pointed to by the RandoMEngine handle are appropriately reference counted in thread safe manner. However, if you need to modify RandomEngine object, then please do wrap the object using a Mutex or Read-Write lock.
Implementations§
Source§impl RandomEngine
impl RandomEngine
Sourcepub fn new(rengine: RandomEngineType, seed: Option<u64>) -> Self
pub fn new(rengine: RandomEngineType, seed: Option<u64>) -> Self
Create a new random engine object
§Parameters
rengine
can be value of RandomEngineType enum.seed
is the initial seed value
§Return Values
A object of type RandomEngine
Sourcepub fn get_type(&self) -> RandomEngineType
pub fn get_type(&self) -> RandomEngineType
Get random engine type
Sourcepub fn set_type(&mut self, engine_type: RandomEngineType)
pub fn set_type(&mut self, engine_type: RandomEngineType)
Get random engine type
Sourcepub unsafe fn get(&self) -> af_random_engine
pub unsafe fn get(&self) -> af_random_engine
Returns the native FFI handle for Rust object RandomEngine
Trait Implementations§
Source§impl Clone for RandomEngine
Increment reference count of RandomEngine’s native resource
impl Clone for RandomEngine
Increment reference count of RandomEngine’s native resource
Source§impl Drop for RandomEngine
Free RandomEngine’s native resource
impl Drop for RandomEngine
Free RandomEngine’s native resource
Source§impl From<*mut c_void> for RandomEngine
Used for creating RandomEngine object from native resource id
impl From<*mut c_void> for RandomEngine
Used for creating RandomEngine object from native resource id