console.log(make_mac().toUpperCase())
function make_mac(){
var mac = make_mac_1();
for(var i=0; i<4; i++){
mac = mac + ':' + make_mac_1();
}
return mac;
}
function make_mac_1(){
var n=Math.round(Math.random()*255);
var n_hex=n.toString(16);
if( n_hex.length==1 ){
n_hex = '0' + n_hex;
}
return n_hex;
}
运行结果:AB:BE:CA:33:AD
最新评论