1 arr.sort(function ( a, b ) { 2 return Math.random() - 0.5; 3 }); Math.random()会产生一个0到1之间的随机值 转载于:https://www.cnblogs.com/frontendnotes/p/6445987.html