使用js,输出1000个0-19位的非数字数据。再输出一个1000个随机的20位的字符串
时间: 2024-03-20 15:38:38 浏览: 50
好的,以下是使用 JavaScript 实现的代码:
```javascript
// 输出1000个0-19位的非数字数据
for (let i = 0; i < 1000; i++) {
let length = Math.floor(Math.random() * 20);
let result = '';
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for (let j = 0; j < length; j++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
console.log(result);
}
// 输出1000个随机的20位字符串
for (let i = 0; i < 1000; i++) {
let result = '';
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for (let j = 0; j < 20; j++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
console.log(result);
}
```
希望能够满足您的需求!
阅读全文