change g_random to deterministicRandom()

This commit is contained in:
chaoguang 2019-05-28 18:37:55 -07:00
parent a7920ef311
commit 5350c2777a
1 changed files with 4 additions and 4 deletions

View File

@ -162,18 +162,18 @@ struct MakoWorkload : KVWorkload {
static void randStr(std::string& str, const int& len) {
str.resize(len);
for (int i = 0; i < len; ++i) {
str[i] = g_random->randomAlphaNumeric();
str[i] = deterministicRandom()->randomAlphaNumeric();
}
}
static void randStr(char *str, const int& len){
for (int i = 0; i < len; ++i) {
str[i] = g_random->randomAlphaNumeric();
str[i] = deterministicRandom()->randomAlphaNumeric();
}
}
Value randomValue() {
const int length = g_random->randomInt(minValueBytes, maxValueBytes + 1);
const int length = deterministicRandom()->randomInt(minValueBytes, maxValueBytes + 1);
randStr(valueString, length);
return StringRef(reinterpret_cast<const uint8_t*>(valueString.c_str()), length);
}
@ -425,7 +425,7 @@ struct MakoWorkload : KVWorkload {
int64_t getRandomKey(uint64_t rowCount) {
// TODO: support other distribution like zipf
return g_random->randomInt64(0, rowCount);
return deterministicRandom()->randomInt64(0, rowCount);
}
int parseOperationsSpec() {
const char *ptr = operationsSpec.c_str();