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

Function VariableCreationProbability

src/VariableSelector.cpp:1046–1055  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1044
1045// --------------------------------------------------------------
1046static eVariableScope
1047VariableCreationProbability(void)
1048{
1049 bool flag = CGOptions::global_variables() && rnd_flipcoin(10);
1050 ERROR_GUARD(MAX_VAR_SCOPE);
1051 if (flag) // 10% chance to create new global var
1052 return eGlobal;
1053 else
1054 return eParentLocal;
1055}
1056
1057// --------------------------------------------------------------
1058Variable *

Callers 1

GenerateNewVariableMethod · 0.85

Calls 1

rnd_flipcoinFunction · 0.85

Tested by

no test coverage detected