Skip to content

Instantly share code, notes, and snippets.

@ferronrsmith
Created June 13, 2013 00:22
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 ferronrsmith/5770269 to your computer and use it in GitHub Desktop.
Save ferronrsmith/5770269 to your computer and use it in GitHub Desktop.
Simple function to generate a random mask url
var uuid = function () {
var mask = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
return (function (mask) {
return mask.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}(mask));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment