#108: function to generate a UUID

This commit is contained in:
Davide Alberani 2016-04-24 15:59:32 +02:00
parent 88fd3daf18
commit 86f5a109a7

View file

@ -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();
}