JavaScript生成随机码

4年以前  |  阅读数:718 次  |  编程语言:JavaScript 
function randomBuildAccessCode(){
    var code = '';
    var chars = '0123456789';
    var maxPos = chars.length;
    for (var i = 0; i < 6; i++) {
        code += Math.floor(Math.random() * maxPos)
    }
    return code
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8