summaryrefslogtreecommitdiffstats
path: root/src/hash_collision_bench.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash_collision_bench.cc')
-rw-r--r--src/hash_collision_bench.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hash_collision_bench.cc b/src/hash_collision_bench.cc
index ff947dc..8f37ed0 100644
--- a/src/hash_collision_bench.cc
+++ b/src/hash_collision_bench.cc
@@ -15,20 +15,22 @@
#include "build_log.h"
#include <algorithm>
-using namespace std;
#include <stdlib.h>
#include <time.h>
+using namespace std;
+
int random(int low, int high) {
return int(low + (rand() / double(RAND_MAX)) * (high - low) + 0.5);
}
void RandomCommand(char** s) {
int len = random(5, 100);
- *s = new char[len];
+ *s = new char[len+1];
for (int i = 0; i < len; ++i)
(*s)[i] = (char)random(32, 127);
+ (*s)[len] = '\0';
}
int main() {