Skip to content

Instantly share code, notes, and snippets.

@dayvonjersen
Last active August 29, 2015 14:24
Show Gist options
  • Save dayvonjersen/ba60ede745878d536db0 to your computer and use it in GitHub Desktop.
Save dayvonjersen/ba60ede745878d536db0 to your computer and use it in GitHub Desktop.
random unique id generator
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