MCPcopy Create free account
hub / github.com/csmith-project/csmith / get_random_single_prob

Method get_random_single_prob

src/Probabilities.cpp:202–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202int
203GroupProbElem::get_random_single_prob(int orig_val, std::vector<unsigned int> &invalid_vals)
204{
205 // we won't change val if it's disallowed before
206 if (orig_val == 0) {
207 return orig_val;
208 }
209 if (is_equal_) {
210 bool p = rnd_flipcoin(50);
211 return (p ? 1 : 0);
212 }
213 else {
214 VectorFilter f(invalid_vals);
215 return rnd_upto(101, &f);
216 }
217}
218
219void
220GroupProbElem::initialize(Probabilities *impl, const std::map<ProbName, int> pairs)

Callers

nothing calls this directly

Calls 2

rnd_flipcoinFunction · 0.85
rnd_uptoFunction · 0.85

Tested by

no test coverage detected