Skip to content

Instantly share code, notes, and snippets.

@adamrobbie
Created June 24, 2012 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamrobbie/2985469 to your computer and use it in GitHub Desktop.
Save adamrobbie/2985469 to your computer and use it in GitHub Desktop.
generate static guid via javascript
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
var myID = "static" + guid();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment