Initialize seed in macro benchmark generators

Reviewers: dgleich, buda, florijan

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D984
This commit is contained in:
Mislav Bradac 2017-11-15 14:26:19 +01:00
parent e703e955a5
commit 6d78873ace
5 changed files with 14 additions and 3 deletions

View File

@ -1,11 +1,15 @@
import random
import common
# Here we set seed to 1, instead of 0, because seed in setup is 0 and we want to
# be sure here that we will generate different numbers.
random.seed(1)
for i in range(common.BFS_ITERS):
a = int(random.random() * common.VERTEX_COUNT)
b = int(random.random() * common.VERTEX_COUNT)
print("MATCH (from: Node {id: %d}) WITH from "
"MATCH (to: Node {id: %d}) WITH to "
"MATCH path = (from)-[*bfs..%d (e, n | true)]->(to) WITH path "
"LIMIT 10 RETURN 0;"
"LIMIT 10 RETURN 0;"
% (a, b, common.PATH_LENGTH))

View File

@ -1,6 +1,8 @@
import random
import common
random.seed(0)
for i in range(common.VERTEX_COUNT):
print("CREATE (n: Node {id: %d});" % i)

View File

@ -1,6 +1,8 @@
import random
import common
random.seed(0)
for i in range(common.VERTEX_COUNT * common.QUERIES_PER_VERTEX):
a = int(random.random() * common.VERTEX_COUNT)
b = int(random.random() * common.VERTEX_COUNT)

View File

@ -1,9 +1,10 @@
""" This file does nothing, it's just utilities for other setups """
from random import randint
from random import randint, seed
BATCH_SIZE = 100
seed(0)
def create_vertices(vertex_count):

View File

@ -2,9 +2,11 @@
Generates a random graph with some configurable statistics.
"""
from random import randint
from random import randint, seed
seed(0)
def rint(upper_bound_exclusive):
return randint(0, upper_bound_exclusive - 1)