#108: function to generate a UUID
This commit is contained in:
parent
88fd3daf18
commit
86f5a109a7
1 changed files with 8 additions and 0 deletions
|
@ -6,3 +6,11 @@ String.prototype.getTime = function() {
|
|||
return new Date(ms);
|
||||
};
|
||||
|
||||
|
||||
/* UUID generator. */
|
||||
function guid() {
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
||||
}
|
||||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue