mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2025-12-06 06:34:06 +00:00
16 lines
397 B
TypeScript
16 lines
397 B
TypeScript
/**
|
|
* Generates a random string containing numbers and letters
|
|
*/
|
|
const generateRandString = (length: number): string => {
|
|
const possible =
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
let text = "";
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
}
|
|
return text;
|
|
};
|
|
|
|
export { generateRandString };
|