Next: , Previous: , Up: API  


1.11 (veritas shuffle)

1.11.1 Procedures

Procedure: fisher-yates-shuffle xs KEY: #:seed

Return the elements of xs in random order (Fisher-Yates).

Shuffling happens on a vector copy, so xs is left alone. seed makes the order reproducible, which is how a failing order is replayed; without it a fresh seed is pulled from random-state-from-platform on every call, so two calls on the same list differ. Lists of one element or fewer come back as they are.

(equal? (fisher-yates-shuffle '(1 2 3) #:seed 7)
        (fisher-yates-shuffle '(1 2 3) #:seed 7))
⇒ #t
Procedure: fresh-seed

Return a new seed for a shuffle, drawn from the platform’s entropy source.

Report the seed of a shuffled run and the run can be replayed: the same seed and the same list always produce the same order.