|
|
|
|
|
by kmcgivney
6075 days ago
|
|
I didn't like the butnth. I get an allergic reaction to append. Blame Ken Tilton. (defun shuffle-in-place (l)
(cond ((null l) nil)
(t (rotatef (nth 0 l)
(nth (random (length l)) l))
(shuffle-in-place (rest l))))
l)
(defun shuffle (l)
(shuffle-in-place (copy-list l)))
|
|
I do. Always.
One could use nconc instead of append, but that's not where the processor cycles are being lost as far as I can tell.