随机生成不相同的手机号码

var __=[];
console.time();
while(__.length<10000){
    var _=Math.floor(Math.random()*9999999999+10000000000);
    if(__.indexOf(_)<0){
        if(!!(/^1[3|5|8][0-9]\d{4,8}$/.test(_))){
            __.push(_.toString());
        }
    }
}
console.timeEnd();

猜你喜欢

转载自blog.csdn.net/weixin_39685861/article/details/78942227