Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = (length) => {
- // Character map
- const characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0987654321' + Date.now()
- // Process variables
- const charactersLength = characters.length
- const output = ''
- // Random number generation
- const max = charactersLength - 1
- const min = 0
- // Generate random characters
- for (i = length; i > 0; i--) {
- output += characters[Math.floor(Math.random() * (max - min + 1)) + min]
- }
- return output
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement