Source: core/xrxUtil.js

  1. /**
  2. * @fileoverview XRX utility functions.
  3. * @private
  4. */
  5. goog.provide('xrx.Util');
  6. goog.require('goog.math');
  7. /**
  8. * @constructor
  9. * @private
  10. */
  11. xrx.Util = function() {};
  12. xrx.Util.createUUID = function() {
  13. var d = new Date().getTime();
  14. var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  15. var r = (d + Math.random()*16)%16 | 0;
  16. d = Math.floor(d/16);
  17. return (c==='x' ? r : (r&0x7|0x8)).toString(16);
  18. });
  19. return uuid;
  20. };