Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
40ed13f1
Commit
40ed13f1
authored
Feb 27, 2019
by
Martin Bauer
Browse files
Generator for random symbols
parent
6a01f3e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
random.py
View file @
40ed13f1
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment