Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / uuid / generateRandomUuid.js @ 9

History | View | Annotate | Download (779 Bytes)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.uuid.generateRandomUuid"]){
9
dojo._hasResource["dojox.uuid.generateRandomUuid"]=true;
10
dojo.provide("dojox.uuid.generateRandomUuid");
11
dojox.uuid.generateRandomUuid=function(){
12
var _1=16;
13
function _2(){
14
var _3=Math.floor((Math.random()%1)*Math.pow(2,32));
15
var _4=_3.toString(_1);
16
while(_4.length<8){
17
_4="0"+_4;
18
}
19
return _4;
20
};
21
var _5="-";
22
var _6="4";
23
var _7="8";
24
var a=_2();
25
var b=_2();
26
b=b.substring(0,4)+_5+_6+b.substring(5,8);
27
var c=_2();
28
c=_7+c.substring(1,4)+_5+c.substring(4,8);
29
var d=_2();
30
var _8=a+_5+b+_5+c+d;
31
_8=_8.toLowerCase();
32
return _8;
33
};
34
}