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

Function uniformDistributionMT

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

Source from the content-addressed store, hash-verified

339
340template<typename T>
341void uniformDistributionMT(T *out, size_t elements, uint *const state,
342 const uint *const pos, const uint *const sh1,
343 const uint *const sh2, uint mask,
344 const uint *const recursion_table,
345 const uint *const temper_table) {
346 uint l_state[STATE_SIZE];
347 uint o[4];
348 uint lpos = pos[0];
349 uint lsh1 = sh1[0];
350 uint lsh2 = sh2[0];
351
352 state_read(l_state, state);
353
354 int reset = (4 * sizeof(uint)) / sizeof(T);
355 for (int i = 0; i < (int)elements; i += reset) {
356 mersenne(o, l_state, i, lpos, lsh1, lsh2, mask, recursion_table,
357 temper_table);
358 int lim = (reset < (int)(elements - i)) ? reset : (int)(elements - i);
359 for (int j = 0; j < lim; ++j) { out[i + j] = transform<T>(o, j); }
360 }
361
362 state_write(state, l_state);
363}
364
365template<typename T>
366void normalDistributionMT(T *out, size_t elements, uint *const state,

Callers

nothing calls this directly

Calls 3

mersenneFunction · 0.85
state_readFunction · 0.70
state_writeFunction · 0.70

Tested by

no test coverage detected