MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / random_normal

Function random_normal

src/core/random.rs:332–349  ·  view source on GitHub ↗

Generate array of normal numbers using a random engine # Parameters - `dims` is output array dimensions - `engine` is an object of type [RandomEngine](./struct.RandomEngine.html) # Return Values An Array with normal numbers generated using random engine

(dims: Dim4, engine: &RandomEngine)

Source from the content-addressed store, hash-verified

330///
331/// An Array with normal numbers generated using random engine
332pub fn random_normal<T>(dims: Dim4, engine: &RandomEngine) -> Array<T>
333where
334 T: HasAfEnum + FloatingPoint,
335{
336 let aftype = T::get_af_dtype();
337 unsafe {
338 let mut temp: af_array = std::ptr::null_mut();
339 let err_val = af_random_normal(
340 &mut temp as *mut af_array,
341 dims.ndims() as c_uint,
342 dims.get().as_ptr() as *const dim_t,
343 aftype as c_uint,
344 engine.get(),
345 );
346 HANDLE_ERROR(AfError::from(err_val));
347 temp.into()
348 }
349}
350
351#[cfg(test)]
352mod tests {

Callers

nothing calls this directly

Calls 4

HANDLE_ERRORFunction · 0.85
ndimsMethod · 0.80
intoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected