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

Function philoxNormal

src/backend/cpu/kernel/random_engine.hpp:297–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295
296template<typename T>
297void philoxNormal(T *out, size_t elements, const uintl seed, uintl counter) {
298 uint hi = seed >> 32;
299 uint lo = seed;
300 uint hic = counter >> 32;
301 uint loc = counter;
302 uint key[2] = {lo, hi};
303 uint ctr[4] = {loc, hic, 0, 0};
304 T temp[(4 * sizeof(uint)) / sizeof(T)];
305
306 int reset = (4 * sizeof(uint)) / sizeof(T);
307 for (int i = 0; i < (int)elements; i += reset) {
308 philox(key, ctr);
309 boxMullerTransform(ctr, temp);
310 int lim = (reset < (int)(elements - i)) ? reset : (int)(elements - i);
311 for (int j = 0; j < lim; ++j) { out[i + j] = temp[j]; }
312 }
313}
314
315template<typename T>
316void threefryNormal(T *out, size_t elements, const uintl seed, uintl counter) {

Callers 1

normalDistributionCBRNGFunction · 0.85

Calls 2

philoxFunction · 0.70
boxMullerTransformFunction · 0.70

Tested by

no test coverage detected