summaryrefslogtreecommitdiff
path: root/impl/systems/generate-random.py
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-11-27 18:20:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-11-27 18:20:06 +1100
commit839764bd955d2bddedb4a38ab1d4d92c797c56b9 (patch)
treeba18f19658c62f5d515d1bdadbf37969f9e99711 /impl/systems/generate-random.py
parent8b9d3f9880824523c16a1101967987f998dc1cb4 (diff)
Thesis and performance testing related stuff.
Diffstat (limited to 'impl/systems/generate-random.py')
-rw-r--r--impl/systems/generate-random.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/impl/systems/generate-random.py b/impl/systems/generate-random.py
index 66467b6..5b54bef 100644
--- a/impl/systems/generate-random.py
+++ b/impl/systems/generate-random.py
@@ -11,8 +11,9 @@ def generate_variable(size):
def generate_expression(size):
if random.randint(1, 5) < 3:
- operator = random.choice(['+', '-'])
- return generate_variable(size) + operator + generate_expression(size);
+ operator = random.choice(['add', 'mul'])
+ args = (generate_expression(size) for i in xrange(random.randint(2, 4)))
+ return "%s(%s)" % (operator, ",".join(args))
else:
return generate_variable(size)