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

Function VariableSelectionProbability

src/VariableSelector.cpp:1026–1043  ·  view source on GitHub ↗

--------------------------------------------------------------

Source from the content-addressed store, hash-verified

1024
1025// --------------------------------------------------------------
1026static eVariableScope
1027VariableSelectionProbability(eVariableScope upper = MAX_VAR_SCOPE, Filter *filter = NULL)
1028{
1029 // Should probably modify choice based on current list of params, parent
1030 // params, parent locals, # of globals, etc.
1031 //
1032 // ...but this is easier.
1033 VariableSelector::InitScopeTable();
1034 do {
1035 int i = rnd_upto(100, filter);
1036 ERROR_GUARD(MAX_VAR_SCOPE);
1037 eVariableScope scope = VariableSelector::scopeTable_->get_value(i);
1038 if (scope < upper) {
1039 return scope;
1040 }
1041 } while (true);
1042 return MAX_VAR_SCOPE;
1043}
1044
1045// --------------------------------------------------------------
1046static eVariableScope

Callers 1

selectMethod · 0.85

Calls 2

rnd_uptoFunction · 0.85
get_valueMethod · 0.45

Tested by

no test coverage detected