Selects a random key. There is a probability that the key will be chosen from the keyset in data, otherwise the key will be a randomly generated key
| 267 | // Selects a random key. There is a <probabilityKeyExists> probability that the key will be chosen from the keyset in |
| 268 | // data, otherwise the key will be a randomly generated key |
| 269 | Key ApiWorkload::selectRandomKey(VectorRef<KeyValueRef> const& data, double probabilityKeyExists) { |
| 270 | if (deterministicRandom()->random01() < probabilityKeyExists) |
| 271 | return data[deterministicRandom()->randomInt(0, data.size())].key; |
| 272 | else |
| 273 | return generateKey(data, minLongKeyLength, maxLongKeyLength, clientPrefix); |
| 274 | } |
| 275 | |
| 276 | // Generates a random value |
| 277 | Value ApiWorkload::generateValue(int minValueLength, int maxValueLength) { |
no test coverage detected