MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_random_normal

Function af_random_normal

src/api/c/random.cpp:312–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312af_err af_random_normal(af_array *out, const unsigned ndims,
313 const dim_t *const dims, const af_dtype type,
314 af_random_engine engine) {
315 try {
316 AF_CHECK(af_init());
317 af_array result;
318
319 dim4 d = verifyDims(ndims, dims);
320 RandomEngine *e = getRandomEngine(engine);
321
322 switch (type) {
323 case f32: result = normalDistribution_<float>(d, e); break;
324 case c32: result = normalDistribution_<cfloat>(d, e); break;
325 case f64: result = normalDistribution_<double>(d, e); break;
326 case c64: result = normalDistribution_<cdouble>(d, e); break;
327 case f16: result = normalDistribution_<half>(d, e); break;
328 default: TYPE_ERROR(4, type);
329 }
330 std::swap(*out, result);
331 }
332 CATCHALL;
333 return AF_SUCCESS;
334}
335
336af_err af_release_random_engine(af_random_engine engineHandle) {
337 try {

Callers 1

randnFunction · 0.50

Calls 4

verifyDimsFunction · 0.85
getRandomEngineFunction · 0.85
swapFunction · 0.85
af_initFunction · 0.70

Tested by

no test coverage detected