标签:
//原数组
var
arr = [0,1,2,3,4,5,6,7,8,9,10,11];
//输出数组
var
out = [];
//输出个数
var
num = 5;
while
(out.length < num){
var
temp = (Math.random()*arr.length) >> 0;
out.push(arr.splice(temp,1));
}
alert(out);
标签:
原文地址:http://www.cnblogs.com/Zeki/p/5902558.html