From aef66a84319670282f6550904487accdabe674d7 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 4 Sep 2021 18:10:44 -0400 Subject: =?UTF-8?q?Define=20monadic=20=E2=80=A2rand.Subset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/system.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/spec/system.html') diff --git a/docs/spec/system.html b/docs/spec/system.html index 3616425c..a7c1efab 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -474,7 +474,7 @@

β€’_timed returns the total time taken divided by the number of function calls (𝕨 if provided and 1 otherwise), including the overhead required for the outer loop that counts iterations (which will typically be negligible in comparison to the BQN code).

More accurately the modifier β€’_maxTime_ may fail if execution of 𝔽 takes over 𝕨𝔾𝕩 seconds, and should fail as quickly as it is practically able to. The most likely way to implement this modifier is to interrupt execution at the given time. If 𝔽 completes before the interrupt there is no need to measure the amount of time it actually took.

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:

@@ -493,11 +493,11 @@ - +
SubsetA sorted SRS of 𝕨 elements of ↕𝕩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 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.

Ranges up to 2⋆32 must be supported (that is, a maximum integer result of (2⋆32)-1) if the number system accommodates it. In implementations based on double-precision floats it's preferable but not required to support ranges up to 2⋆53.

-- cgit v1.2.3