MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / randint

Function randint

utils/array_utils.hpp:182–187  ·  view source on GitHub ↗

* @brief Populate the array with random integers. * @param a The array to populate. * @param N The number of elements in the array. * @param gen The random number generator. * @param min The minimum value for the random integers. * @param max The maximum value for the random integers. */

Source from the content-addressed store, hash-verified

180 * @param max The maximum value for the random integers.
181 */
182void randint(float *a, size_t N, std::mt19937 &gen, int min = -1, int max = 1) {
183 std::uniform_int_distribution<> dist(min, max);
184 for (int i = 0; i < N; i++) {
185 a[i] = static_cast<float>(dist(gen));
186 }
187}
188
189/**
190 * @brief Overload of `randint()` for std::array.

Callers 6

mainFunction · 0.85
mainFunction · 0.85
testMatmulFunction · 0.85
testGeluFunction · 0.85
testLayerNormFunction · 0.85
testSoftmaxFunction · 0.85

Calls

no outgoing calls

Tested by 4

testMatmulFunction · 0.68
testGeluFunction · 0.68
testLayerNormFunction · 0.68
testSoftmaxFunction · 0.68