Skip to content

Instantly share code, notes, and snippets.

@dshaw
Created May 7, 2010 17:05
Show Gist options
  • Save dshaw/393718 to your computer and use it in GitHub Desktop.
Save dshaw/393718 to your computer and use it in GitHub Desktop.
uuid.js
// From: http://github.com/wuher/oauth2/blob/master/lib/oauth2.js
/*
* implementation copied from narwhal/lib/uuid.js
* this is because narwhal/engines/rhino/lib/uuid.js overrides this
*/
var CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
var generate_verifier = function (length, radix) {
var chars = CHARS, uuid = [], rnd = Math.random;
length = length || 8;
radix = radix || chars.length;
for (var i = 0; i < length; i++) uuid[i] = chars[0 | rnd()*radix];
return uuid.join('');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment