aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-09-04 18:10:44 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-09-04 18:10:44 -0400
commitaef66a84319670282f6550904487accdabe674d7 (patch)
treedad97ddaf35e81201b6a21d4b6c3e4293a2ffafb /spec
parentddf99fe01eaefb0b6f838f8111287141a946be88 (diff)
Define monadic β€’rand.Subset
Diffstat (limited to 'spec')
-rw-r--r--spec/system.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/system.md b/spec/system.md
index b62db9e5..15ada7b4 100644
--- a/spec/system.md
+++ b/spec/system.md
@@ -210,17 +210,17 @@ More accurately the modifier `β€’_maxTime_` *may* fail if execution of `𝔽` ta
## Random generation
-`β€’MakeRand` initializes a deterministic pseudorandom number generator with seed value `𝕩`. `β€’rand`, if it exists, is a globally accessible generator initialized at first use; this initialization should use randomness from an outside source if available. A random generator has the following member functions:
+`β€’MakeRand` initializes a deterministic pseudorandom number generator with seed value `𝕩`. `β€’rand`, if it exists, is a globally accessible generator initialized at first use; this initialization should use randomness from an outside source if available. These random generators aren't required to be cryptographically secure and should always be treated as insecure. A random generator has the following member functions:
| Name | Summary
|-----------|------------------------------
| `Range` | A number, or array of shape `𝕨`, selected from `↕𝕩`
| `Deal` | A simple random sample of `π•¨βŠ£π•©` elements of `↕𝕩`
-| `Subset` | A sorted SRS of `𝕨` elements of `↕𝕩`
+| `Subset` | A sorted SRS of `↕𝕩`, with `𝕨` elements if given
For each of these functions, `𝕩` is a natural number. For `Range`, `𝕨` must be a valid shape if given, and for `Deal` and `Subset` it's a natural number less than or equal to `𝕩`. All selections are made uniformly at random, that is, each possible result is equally likely. A simple random sample (SRS) of `k` elements from list `s` is a list of `k` distinct elements of `s` in any order. Both the choice of elements and their ordering must be uniformly random. [Recommended algorithms](../implementation/primitive/random.md#simple-random-sample) for SRS selection are variants of a partial Knuth shuffle.
-When `𝕨` isn't given, `Deal`'s result contains all elements of `↕𝕩`, making it a random shuffle of those values, or random permutation. In `Subset`, setting `𝕨` to `𝕩` would instead always result in the list `↕𝕩`; because this is not useful, `𝕨` must be provided.
+When `𝕨` isn't given, `Deal`'s result contains all elements of `↕𝕩`, making it a random shuffle of those values, or random permutation. In `Subset`, a random choice is made uniformly from the `2⋆𝕩` subsets of `↕𝕩`, so that a subset of any length may be returned.
In `Range`, `𝕩` may be `0`. In this case the result consists of floating-point numbers in the unit interval from 0 to 1. The numbers should have an overall uniform distribution, but their precision and whether the endpoints 0 and 1 are possible may depend on the implementation.