| CARVIEW |
Select Language
HTTP/1.1 200 Document follows
Server: nginx/1.24.0 (Ubuntu)
Date: Wed, 31 Dec 2025 03:04:14 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
last-modified: Sat, 27 Dec 2025 23:38:34 GMT
Content-Encoding: gzip
sample ( seq n -- seq' ) - Factor Documentation
sample ( seq n -- seq' )
Generating random integers
Generating random integers
| Prev: | randomize ( seq -- randomized ) |
| Next: | delete-random ( seq -- elt ) |
Vocabulary
random
Inputs
Outputs
Word description
Takes n samples at random without replacement from a sequence. Throws an error if n is longer than the sequence.
Examples
Definition
random
Inputs
| seq | a sequence |
| n | an integer |
Outputs
| seq' | a sequence |
Word description
Takes n samples at random without replacement from a sequence. Throws an error if n is longer than the sequence.
Examples
USING: random prettyprint ;
{ 1 2 3 } 2 sample .
{ 3 2 }
{ 3 2 }
Definition