Next: (veritas veritas), Previous: (veritas runner), Up: API
Return a new list containing the elements of xs in a randomized permutation.
Implements the modern Fisher–Yates (also known as the Knuth) shuffle algorithm. To ensure optimal performance, the input list xs is copied into an internal vector to leverage O(1) random access and mutation. The elements are shuffled in-place within the vector before being converted back into a standard Scheme list.
Every invocation automatically re-initializes Guile’s internal
*random-state* variable using system entropy via
random-state-from-platform to ensure high-quality pseudo-random
distribution.
If xs is empty or contains only a single element, it is returned unmodified.
(fisher-yates-shuffle '(1 2 3 4 5)) ⇒ (4 1 5 3 2) ; Note: Output is randomized and non-deterministic