Handbook
Glossary
delete-random ( seq -- elt )
Generating random integers
Prev:
sample ( seq n -- seq' )
Next:
random-bytes ( n -- byte-array )
Vocabulary
random
Inputs
seq
a
sequence
Outputs
elt
an
object
Word description
Deletes a random number from a sequence using
remove-nth!
and returns the deleted object.
Definition
USING:
kernel
sequences
;
IN:
random
:
delete-random
( seq -- elt )
[
length
random
]
keep
[
nth
]
2keep
remove-nth!
drop
;