From 16e1ab7d22210385c40a61d25faba5aa31379609 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 13 Oct 2021 14:25:39 -0400 Subject: =?UTF-8?q?Clarify=20shape=20requirements=20for=20=F0=9D=95=A8=20i?= =?UTF-8?q?n=20=E2=80=A2rand.Range?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/system.html | 2 +- spec/system.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/system.html b/docs/spec/system.html index a7c1efab..f9839980 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -497,7 +497,7 @@ -

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.

+

For each of these functions, 𝕩 is a natural number. For Range, 𝕨 must be a valid shape (natural number, or list or unit array of natural numbers) 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, 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 232 must be supported (that is, a maximum integer result of (232)-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 253.

diff --git a/spec/system.md b/spec/system.md index 15ada7b4..71d4fb9d 100644 --- a/spec/system.md +++ b/spec/system.md @@ -218,7 +218,7 @@ More accurately the modifier `•_maxTime_` *may* fail if execution of `𝔽` ta | `Deal` | A simple random sample 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. +For each of these functions, `𝕩` is a natural number. For `Range`, `𝕨` must be a valid shape (natural number, or list or unit array of natural numbers) 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`, a random choice is made uniformly from the `2⋆𝕩` subsets of `↕𝕩`, so that a subset of any length may be returned. -- cgit v1.2.3