| 277 | } |
| 278 | |
| 279 | af_err af_random_uniform(af_array *out, const unsigned ndims, |
| 280 | const dim_t *const dims, const af_dtype type, |
| 281 | af_random_engine engine) { |
| 282 | try { |
| 283 | AF_CHECK(af_init()); |
| 284 | af_array result; |
| 285 | |
| 286 | dim4 d = verifyDims(ndims, dims); |
| 287 | RandomEngine *e = getRandomEngine(engine); |
| 288 | |
| 289 | switch (type) { |
| 290 | case f32: result = uniformDistribution_<float>(d, e); break; |
| 291 | case c32: result = uniformDistribution_<cfloat>(d, e); break; |
| 292 | case f64: result = uniformDistribution_<double>(d, e); break; |
| 293 | case c64: result = uniformDistribution_<cdouble>(d, e); break; |
| 294 | case s32: result = uniformDistribution_<int>(d, e); break; |
| 295 | case u32: result = uniformDistribution_<uint>(d, e); break; |
| 296 | case s64: result = uniformDistribution_<intl>(d, e); break; |
| 297 | case u64: result = uniformDistribution_<uintl>(d, e); break; |
| 298 | case s16: result = uniformDistribution_<short>(d, e); break; |
| 299 | case u16: result = uniformDistribution_<ushort>(d, e); break; |
| 300 | case s8: result = uniformDistribution_<schar>(d, e); break; |
| 301 | case u8: result = uniformDistribution_<uchar>(d, e); break; |
| 302 | case b8: result = uniformDistribution_<char>(d, e); break; |
| 303 | case f16: result = uniformDistribution_<half>(d, e); break; |
| 304 | default: TYPE_ERROR(4, type); |
| 305 | } |
| 306 | std::swap(*out, result); |
| 307 | } |
| 308 | CATCHALL; |
| 309 | return AF_SUCCESS; |
| 310 | } |
| 311 | |
| 312 | af_err af_random_normal(af_array *out, const unsigned ndims, |
| 313 | const dim_t *const dims, const af_dtype type, |
no test coverage detected