add contract check to shuffle
This commit is contained in:
parent
3cb7044976
commit
afde639ec5
|
@ -601,6 +601,7 @@
|
|||
|
||||
;; Fisher-Yates Shuffle
|
||||
(define (shuffle l)
|
||||
(unless (list? l) (raise-argument-error 'shuffle "list?" 0 l))
|
||||
(define a (make-vector (length l)))
|
||||
(for ([x (in-list l)] [i (in-naturals)])
|
||||
(define j (random (add1 i)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user