Commit 40ed13f1 authored by Martin Bauer's avatar Martin Bauer
Browse files

Generator for random symbols

parent 6a01f3e2
......@@ -109,3 +109,14 @@ class PhiloxFourFloats(CustomCodeNode):
def __repr__(self):
return "{}, {}, {}, {} <- PhiloxRNG".format(*self.result_symbols)
def random_symbol(assignment_list, rng_node=PhiloxTwoDoubles, *args, **kwargs):
while True:
node = rng_node(*args, **kwargs)
inserted = False
for symbol in node.result_symbols:
if not inserted:
assignment_list.insert(0, node)
inserted = True
yield symbol
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment