Tidy up prng.md (#2033)

* Tidy up prng.md

Make bulleted list alphabetical, to match references in subsequent text, and fix a little reduplication typo further below.
This commit is contained in:
Christopher Suter 2020-01-23 14:07:57 -05:00 committed by Peter Hawkins
parent a61bcff54d
commit 8cf6cd8768

View File

@ -96,10 +96,11 @@ def main():
```
Some points to notice:
- there is no sequential dependence between the calls to bar() and baz() and they can be evaluated in either order without affecting the value of the result, which solves the remaining performance goals (#5, #6),
- functions do not need to return updated versions of PRNGs and it is straightforward to call a random subroutine without affecting existing PRNG states, improving the expressiveness (#1) from the other functional model.
The example doesnt show it, but as a consequence of the choice (B) the only way to advance the PRNG state is to call split(). That is, we have two ways to achieve (A), and they differ in whether they burden the user program with explicit calls to split(), as in the above example, or instead burden the user program with explicit threading. We prefer the former, i.e. the version with explicit splitting, because we can easily implement the explicit-threading version in terms of it.
1. there is no sequential dependence between the calls to bar() and baz() and they can be evaluated in either order without affecting the value of the result, which solves the remaining performance goals (#5, #6),
2. functions do not need to return updated versions of PRNGs and it is straightforward to call a random subroutine without affecting existing PRNG states, improving the expressiveness (#1) from the other functional model.
The example doesnt show it, but as a consequence of the choice (2) the only way to advance the PRNG state is to call split(). That is, we have two ways to achieve (1), and they differ in whether they burden the user program with explicit calls to split(), as in the above example, or instead burden the user program with explicit threading. We prefer the former, i.e. the version with explicit splitting, because we can easily implement the explicit-threading version in terms of it.
## Design
@ -176,7 +177,7 @@ def parallel(*layers):
return init_fun, apply_fun
```
Here were using a version a simple extended version of split that can produce multiple copies.
Here were using a simple extended version of split that can produce multiple copies.
## Tradeoffs and alternatives