9 lines
271 B
JavaScript
9 lines
271 B
JavaScript
|
export default function random(length) {
|
||
|
let text = '';
|
||
|
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||
|
for (let i = 0; i < length; i += 1) {
|
||
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||
|
}
|
||
|
return text;
|
||
|
}
|