js实现任意长度的伪随机字符串

时间:2021-09-15 12:48:15   收藏:0   阅读:20

funtion fn(len){
let stringA = ‘abcd.....890‘;
let length = stringA.length;
let temp = ‘‘;
for(let i=0;i<len;i++){
temp += stringA.CharAt(Math.floor(Math.random( )*length));
}
return temp;
}

原文:https://www.cnblogs.com/sonsmart/p/15265665.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!