Skip to content

Instantly share code, notes, and snippets.

@cori
Forked from strobemonkey/guid.js
Created May 26, 2011 19:52
Show Gist options
  • Save cori/993929 to your computer and use it in GitHub Desktop.
Save cori/993929 to your computer and use it in GitHub Desktop.
gimme a guid (popup)
var guid = function(){
return 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
}).toUpperCase();
};
var nil=prompt("Here's your GUID",guid());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment