I've written vector version. As you can make subvectors really
fast, and you can take element at index really fast, I just throw
out last element at each iteration.
(letfn [(vec-throw-out [v i]
(pop (assoc v i (get v (dec (count v))]
(defn lazy-shuffle [v]
(if (seq v)
(let [idx
Hmm. (time isn't that reliable here. my lazy-shuffle might be quite
slow after all.
On Jan 26, 10:46 pm, bOR_ wrote:
> In addition to the functional shuffle thread (can't seem to post to
> that one anymore, might be too old?), I've written alazy shuffle. Not
> sure if it is the best way to write
In addition to the functional shuffle thread (can't seem to post to
that one anymore, might be too old?), I've written a lazy shuffle. Not
sure if it is the best way to write it, but I needed a lazy shuffle
primarily because I wanted to randomly pair a few agents from a large
vector of agents with