--------------------------------------------------------------
| 1024 | |
| 1025 | // -------------------------------------------------------------- |
| 1026 | static eVariableScope |
| 1027 | VariableSelectionProbability(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 | // -------------------------------------------------------------- |
| 1046 | static eVariableScope |