[alexandria-devel] Bug in shuffle (sequences.lisp)

Jianshi Huang jianshi.huang at gmail.com
Tue Nov 8 09:27:15 UTC 2011


(loop for i from (- end 1) downto start      do (rotatef (aref
sequence i) (aref sequence (random (+ i 1)))))
should be

(loop for i from start below end      do (rotatef (aref sequence i)
(aref sequence (+ i (random (- end i))))))
otherwise the element selected won't be bound by [start, end),

similar bug in the sequence typed version
Cheers,
-- 
黄 澗石 (Jianshi Huang)
http://huangjs.net/




More information about the alexandria-devel mailing list