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

Method random_choice

src/SimpleDeltaRndNumGenerator.cpp:91–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91int
92SimpleDeltaRndNumGenerator::random_choice (int bound, const Filter *f, const string *)
93{
94 assert(seq_);
95
96 int rv = seq_->get_number(bound);
97 ++rand_depth_;
98
99 if (rv == -1) {
100 Error::set_error(INVALID_SIMPLE_DELTA_SEQUENCE);
101 return -1;
102 }
103
104 if (f) {
105 ++filter_depth_;
106 if (f->filter(rv)) {
107 Error::set_error(FILTER_ERROR);
108 return -1;
109 }
110 --filter_depth_;
111 }
112 switch_to_default_generator();
113 return rv;
114}
115
116/*
117 *

Callers

nothing calls this directly

Calls 2

get_numberMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected