Guest User

Untitled

a guest
Mar 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function _uuid() {
  2. var d = Date.now();
  3. if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
  4. d += performance.now(); //use high-precision timer if available
  5. }
  6. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  7. var r = (d + Math.random() * 16) % 16 | 0;
  8. d = Math.floor(d / 16);
  9. return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
  10. });
  11. }
Add Comment
Please, Sign In to add comment