Browse Source

把随机种子改成一样的

pull/1/head
ssynn 1 month ago
parent
commit
fc03061956
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      test/db_test2.cc

+ 2
- 2
test/db_test2.cc View File

@ -23,7 +23,7 @@ Status OpenDB(std::string dbName, DB **db) {
void InsertData(DB *db) {
WriteOptions writeOptions;
int key_num = data_size / value_size;
srand(static_cast<unsigned int>(time(0)));
srand(0);
for (int i = 0; i < key_num; i++) {
int key_ = rand() % key_num+1;
@ -39,7 +39,7 @@ void GetData(DB *db, int size = (1 << 30)) {
int key_num = data_size / value_size;
// 点查
srand(static_cast<unsigned int>(time(0)));
srand(0);
for (int i = 0; i < 100; i++) {
int key_ = rand() % key_num+1;
std::string key = std::to_string(key_);

Loading…
Cancel
Save