Last active
February 28, 2018 15:37
-
-
Save aleclarson/e07851ecda9fb132f7cbdf3cf98e1008 to your computer and use it in GitHub Desktop.
randomString.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.randomString = (function() { | |
var chars = 'abcdefghijklmnopqrstuvwxyz' | |
return function randomString(len) { | |
if (!len) len = 10 | |
var str = '' | |
for (var i = 0; i < len; i++) { | |
str += chars[Math.floor(Math.random() * chars.length)] | |
} | |
return str | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment