12345678910111213141516 |
- /*
- * @Author: awj
- * @Date: 2020-03-23 18:57:52
- * @LastEditors: awj
- * @LastEditTime: 2020-03-23 19:03:50
- * @Description: description
- */
- export function getRandomString(len = 10) {
- const chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678"; /** **默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
- const maxPos = chars.length;
- let randomString = "";
- for (let i = 0; i < len; i++) {
- randomString += chars.charAt(Math.floor(Math.random() * maxPos));
- }
- return randomString;
- }
|