function shuffleContent(container) {
var content = container.find("> *");
var total = content.size();
content.each(function() {
content.eq(Math.floor(Math.random()*total)).prependTo(container);
});
}
$(function() {
shuffleContent($("ul#test"));
});
http://www.almondlab.jp/notes/1121