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

Function af_randu

src/api/c/random.cpp:345–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345af_err af_randu(af_array *out, const unsigned ndims, const dim_t *const dims,
346 const af_dtype type) {
347 try {
348 AF_CHECK(af_init());
349 af_array result;
350
351 af_random_engine engine;
352 AF_CHECK(af_get_default_random_engine(&engine));
353 RandomEngine *e = getRandomEngine(engine);
354 dim4 d = verifyDims(ndims, dims);
355
356 switch (type) {
357 case f32: result = uniformDistribution_<float>(d, e); break;
358 case c32: result = uniformDistribution_<cfloat>(d, e); break;
359 case f64: result = uniformDistribution_<double>(d, e); break;
360 case c64: result = uniformDistribution_<cdouble>(d, e); break;
361 case s32: result = uniformDistribution_<int>(d, e); break;
362 case u32: result = uniformDistribution_<uint>(d, e); break;
363 case s64: result = uniformDistribution_<intl>(d, e); break;
364 case u64: result = uniformDistribution_<uintl>(d, e); break;
365 case s16: result = uniformDistribution_<short>(d, e); break;
366 case u16: result = uniformDistribution_<ushort>(d, e); break;
367 case s8: result = uniformDistribution_<schar>(d, e); break;
368 case u8: result = uniformDistribution_<uchar>(d, e); break;
369 case b8: result = uniformDistribution_<char>(d, e); break;
370 case f16: result = uniformDistribution_<half>(d, e); break;
371 default: TYPE_ERROR(3, type);
372 }
373 std::swap(*out, result);
374 }
375 CATCHALL
376 return AF_SUCCESS;
377}
378
379af_err af_randn(af_array *out, const unsigned ndims, const dim_t *const dims,
380 const af_dtype type) {

Callers 15

homographyFunction · 0.70
randuTestFunction · 0.50
randuArgsTestFunction · 0.50
testFunctionFunction · 0.50
TESTFunction · 0.50
TESTFunction · 0.50
TESTFunction · 0.50
TESTFunction · 0.50
mainFunction · 0.50
transposeip_testFunction · 0.50
TESTFunction · 0.50
TESTFunction · 0.50

Calls 5

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

Tested by 2

initMethod · 0.40
toTempFormatFunction · 0.40