| 1132 | } |
| 1133 | |
| 1134 | int DistributionTable::key_to_prob(int key) const |
| 1135 | { |
| 1136 | for (size_t i=0; i<keys_.size(); i++) { |
| 1137 | if (keys_[i] == key) { |
| 1138 | return probs_[i]; |
| 1139 | } |
| 1140 | } |
| 1141 | // 0 probablility for keys not found |
| 1142 | return 0; |
| 1143 | } |
| 1144 | |
| 1145 | int DistributionTable::rnd_num_to_key(int rnd) const |
| 1146 | { |