There's a shuffle function in seq-utils:

user=> (use 'clojure.contrib.seq-utils)
nil
user=> (shuffle (list 1 2 3 4))
(3 4 1 2)

 -Lee


On Apr 4, 2010, at 4:14 PM, Linus Ericsson wrote:

> Hello Clojure!
> 
> Is there any straight-forward way to randomly reorder a list?
> 
> ie:
> 
> (randomize-list (list 1 2 3 4))
> -> (3 2 1 4)
> 
> Regards, 
> Linus Ericsson
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to