Last active
August 29, 2015 14:24
-
-
Save dayvonjersen/ba60ede745878d536db0 to your computer and use it in GitHub Desktop.
random unique id generator
This file contains 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
function uniqid(prefix) { | |
prefix = typeof(prefix) === "undefined" ? "r4nd0m" : prefix.toString(); | |
function q() { | |
return parseInt(Math.pow(2,32) * Math.random(),10).toString(16); | |
} | |
return prefix + q() + q() + q() + q(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment