verdnatura-chat/e2e/helpers/random.ts

11 lines
285 B
TypeScript
Raw Normal View History

2023-03-07 12:28:51 +00:00
function random(length = 10) {
2018-05-23 13:39:18 +00:00
let text = '';
2023-03-07 12:28:51 +00:00
const possible = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
2018-05-23 13:39:18 +00:00
for (let i = 0; i < length; i += 1) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
export default random;