diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-14 15:39:19 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-14 15:39:19 +0000 |
commit | 1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch) | |
tree | 3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/uuid/generateRandomUuid.js | |
parent | 104d59099e048688c4dbac37d72137006e396558 (diff) | |
download | semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2 |
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/uuid/generateRandomUuid.js')
-rw-r--r-- | includes/js/dojox/uuid/generateRandomUuid.js | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/includes/js/dojox/uuid/generateRandomUuid.js b/includes/js/dojox/uuid/generateRandomUuid.js deleted file mode 100644 index ec590e9..0000000 --- a/includes/js/dojox/uuid/generateRandomUuid.js +++ /dev/null @@ -1,56 +0,0 @@ -if(!dojo._hasResource["dojox.uuid.generateRandomUuid"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.uuid.generateRandomUuid"] = true; -dojo.provide("dojox.uuid.generateRandomUuid"); - -dojox.uuid.generateRandomUuid = function(){ - // summary: - // This function generates random UUIDs, meaning "version 4" UUIDs. - // description: - // A typical generated value would be something like this: - // "3b12f1df-5232-4804-897e-917bf397618a" - // - // For more information about random UUIDs, see sections 4.4 and - // 4.5 of RFC 4122: http://tools.ietf.org/html/rfc4122#section-4.4 - // - // This generator function is designed to be small and fast, - // but not necessarily good. - // - // Small: This generator has a small footprint. Once comments are - // stripped, it's only about 25 lines of code, and it doesn't - // dojo.require() any other modules. - // - // Fast: This generator can generate lots of new UUIDs fairly quickly - // (at least, more quickly than the other dojo UUID generators). - // - // Not necessarily good: We use Math.random() as our source - // of randomness, which may or may not provide much randomness. - // examples: - // var string = dojox.uuid.generateRandomUuid(); - var HEX_RADIX = 16; - - function _generateRandomEightCharacterHexString(){ - // Make random32bitNumber be a randomly generated floating point number - // between 0 and (4,294,967,296 - 1), inclusive. - var random32bitNumber = Math.floor( (Math.random() % 1) * Math.pow(2, 32) ); - var eightCharacterHexString = random32bitNumber.toString(HEX_RADIX); - while(eightCharacterHexString.length < 8){ - eightCharacterHexString = "0" + eightCharacterHexString; - } - return eightCharacterHexString; // for example: "3B12F1DF" - } - - var hyphen = "-"; - var versionCodeForRandomlyGeneratedUuids = "4"; // 8 == binary2hex("0100") - var variantCodeForDCEUuids = "8"; // 8 == binary2hex("1000") - var a = _generateRandomEightCharacterHexString(); - var b = _generateRandomEightCharacterHexString(); - b = b.substring(0, 4) + hyphen + versionCodeForRandomlyGeneratedUuids + b.substring(5, 8); - var c = _generateRandomEightCharacterHexString(); - c = variantCodeForDCEUuids + c.substring(1, 4) + hyphen + c.substring(4, 8); - var d = _generateRandomEightCharacterHexString(); - var returnValue = a + hyphen + b + hyphen + c + d; - returnValue = returnValue.toLowerCase(); - return returnValue; // String -}; - -} |