mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 08:42:13 +02:00
16 lines
457 B
JavaScript
16 lines
457 B
JavaScript
/**
|
|
* @param { number } num desired length of characters
|
|
* @description generates random alphanumeric characters
|
|
* @returns { string } a string of random characters
|
|
*/
|
|
|
|
module.exports = (num = 15) => {
|
|
const input =
|
|
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
let output = '';
|
|
for (let i = 0; i < num; i++) {
|
|
output += input.charAt(Math.floor(Math.random() * input.length));
|
|
}
|
|
return output;
|
|
};
|