MCPcopy Create free account
hub / github.com/Niko1221/Strata / draw

Function draw

engine/src/split/src/session.cpp:76–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76int draw(const Dist& d, double u) {
77 double cum = 0.0;
78 for (size_t i = 0; i < d.ids.size(); ++i) {
79 cum += d.p[i];
80 if (u < cum) return d.ids[i];
81 }
82 return d.ids.back();
83}
84
85namespace {
86// each penalized token once with its count among the last n of seq

Callers 5

draft_oneMethod · 0.70
windowMethod · 0.70
draft_batchedMethod · 0.70
sample_tokenFunction · 0.70
generateMethod · 0.70

Calls 2

sizeMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected