MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / box_muller

Function box_muller

src/framework/sampling/torch_random.cpp:64–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 }
63 return counter;
64}
65
66void box_muller(uint32_t uniform0, uint32_t uniform1, float & normal0, float & normal1) {
67 const float radius_input =
68 static_cast<float>(uniform0) * kInvTwoPow32 + (kInvTwoPow32 * 0.5F);
69 const float angle =
70 static_cast<float>(uniform1) * kInvTwoPow32TwoPi + (kInvTwoPow32TwoPi * 0.5F);
71 const float radius = std::sqrt(-2.0F * std::log(radius_input));
72 normal0 = radius * std::sin(angle);
73 normal1 = radius * std::cos(angle);
74}
75

Callers 2

torch_cuda_randn_elementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected