Skip to content

Instantly share code, notes, and snippets.

@ianstarz
Forked from shawndumas/guid.js
Created March 15, 2016 17:27
Show Gist options
  • Save ianstarz/2c35a0c286f692462457 to your computer and use it in GitHub Desktop.
Save ianstarz/2c35a0c286f692462457 to your computer and use it in GitHub Desktop.
GUID
var guid = function fn (n) {
return n ?
(n ^ Math.random() * 16 >> n/4).toString(16) :
('10000000-1000-4000-8000-100000000000'.replace(/[018]/g, fn));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment