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

Function af_randn

src/api/c/random.cpp:379–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379af_err af_randn(af_array *out, const unsigned ndims, const dim_t *const dims,
380 const af_dtype type) {
381 try {
382 AF_CHECK(af_init());
383 af_array result;
384
385 af_random_engine engine;
386 AF_CHECK(af_get_default_random_engine(&engine));
387 RandomEngine *e = getRandomEngine(engine);
388 dim4 d = verifyDims(ndims, dims);
389
390 switch (type) {
391 case f32: result = normalDistribution_<float>(d, e); break;
392 case c32: result = normalDistribution_<cfloat>(d, e); break;
393 case f64: result = normalDistribution_<double>(d, e); break;
394 case c64: result = normalDistribution_<cdouble>(d, e); break;
395 case f16: result = normalDistribution_<half>(d, e); break;
396 default: TYPE_ERROR(3, type);
397 }
398 std::swap(*out, result);
399 }
400 CATCHALL
401 return AF_SUCCESS;
402}
403
404af_err af_set_seed(const uintl seed) {
405 try {

Callers 2

randnTestFunction · 0.50
randnFunction · 0.50

Calls 5

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

Tested by

no test coverage detected