Skip to content

Instantly share code, notes, and snippets.

@js2me
Last active August 16, 2019 04:11
Show Gist options
  • Save js2me/c1fceed3c7c9dd30a919a8551aca20c4 to your computer and use it in GitHub Desktop.
Save js2me/c1fceed3c7c9dd30a919a8551aca20c4 to your computer and use it in GitHub Desktop.
Random max safe integer number
export function uuid(a) {
return a ? (a ^ Math.random() * 16 >> a / 4).toString(16) : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment