Hey Aria,
Here's my (not functional) but reasonably fast (Knuth) shuffle I've
been using.
(defn random-permutation [s]
"Return a random permutation of this seq."
(let [arr (to-array s) len (alength arr)]
(dotimes [i (dec len)]
(let [r (+ i (rand-int (- len i))),
prev (a
On Sun, Jan 4, 2009 at 10:17 PM, aria42 wrote:
>
> Hey all, I wanted to write a functional shuffle sequence (not lazy)
> rather than call out to Java.
See also:
http://groups.google.com/group/clojure/browse_thread/thread/180842eb58c58370
--Chouser
--~--~-~--~~~---~