首页 > 代码库 > 产生不重复的随机数据

产生不重复的随机数据

<script>var a=["1","2","3","4","5"];shuffleArray(a);alert(shuffleArray(a));function shuffleArray(array) {		for (var i = array.length - 1; i > 0; i--) {			var j = Math.floor(Math.random() * (i + 1));			var temp = array[i];			array[i] = array[j];			array[j] = temp;		}		return array;	}</script>

  

产生不重复的随机数据