export const RandomId = (n: number) => {
var str = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K',
'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
var res = '';
for (var i = 0; i < n; i++) {
var id = Math.ceil(Math.random() * 35);
res += str[id];
}
return res;
};
//调用
RandomId(16)
07-27
2341
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-17
3457
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)