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

Function random_f32

experimental/kernels/gpt2_webgpu.cpp:633–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631 return (*state * 0x2545F4914F6CDD1Dull) >> 32;
632}
633float random_f32(uint64_t *state) { // random float32 in [0,1)
634 return (random_u32(state) >> 8) / 16777216.0f;
635}
636
637int sample_mult(float* probabilities, int n, float coin) {
638 // sample index from probabilities (they must sum to 1!)

Callers 1

mainFunction · 0.85

Calls 1

random_u32Function · 0.85

Tested by

no test coverage detected