// https://github.com/qiniu/js-sdk/blob/d1792bd4cdaa02ea677aef22539a5f1c1e8a942f/test/demo1/js/moxie.js#L525 /** Generates an unique ID. The only way a user would be able to get the same ID is if the two persons at the same exact millisecond manage to get the same 5 random numbers between 0-65535; it also uses a counter so each ID is guaranteed to be unique for the given page. It is more probable for the earth to be hit with an asteroid. @methodguid @static @param {String} prefix to prepend (by default 'o' will be prepended). @methodguid @return {String} Virtually unique id. */ var guid = (function() { var counter = 0;
returnfunction(prefix) { var guid = newDate().getTime().toString(32), i;
for (i = 0; i < 5; i++) { guid += Math.floor(Math.random() * 65535).toString(32); }