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

Function random_uniform

src/core/random.rs:303–320  ·  view source on GitHub ↗

Generate array of uniform 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 uniform numbers generated using random engine

(dims: Dim4, engine: &RandomEngine)

Source from the content-addressed store, hash-verified

301///
302/// An Array with uniform numbers generated using random engine
303pub fn random_uniform<T>(dims: Dim4, engine: &RandomEngine) -> Array<T>
304where
305 T: HasAfEnum,
306{
307 let aftype = T::get_af_dtype();
308 unsafe {
309 let mut temp: af_array = std::ptr::null_mut();
310 let err_val = af_random_uniform(
311 &mut temp as *mut af_array,
312 dims.ndims() as c_uint,
313 dims.get().as_ptr() as *const dim_t,
314 aftype as c_uint,
315 engine.get(),
316 );
317 HANDLE_ERROR(AfError::from(err_val));
318 temp.into()
319 }
320}
321
322/// Generate array of normal numbers using a random engine
323///

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