Skip to content

Instantly share code, notes, and snippets.

@DanyelMorales
Created July 20, 2017 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanyelMorales/248aa27e8945fc1bfb3490b2be70479f to your computer and use it in GitHub Desktop.
Save DanyelMorales/248aa27e8945fc1bfb3490b2be70479f to your computer and use it in GitHub Desktop.
RANDOM ASCII NAME BASED ON TIMESTAMP
var name = "";
var timest = (Math.trunc(Math.round(new Date().getTime()/1000))) + "";
for (var i = 0, len = timest.length; i < len; i++) {
var current = parseInt(timest[i]);
var ascii = Math.floor(Math.random() * (7-6+1)) + 6;
name+=String.fromCharCode(ascii+""+current) + "";
}
alert(name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment