geek.js 325 B

1234567891011121314
  1. "use strict";
  2. function generateUUID() {
  3. let uuid = "";
  4. const chars = "0123456789abcdef";
  5. for (let i = 0; i < 32; i++) {
  6. if (i === 8 || i === 12 || i === 16 || i === 20) {
  7. uuid += "-";
  8. }
  9. uuid += chars[Math.floor(Math.random() * chars.length)];
  10. }
  11. return uuid;
  12. }
  13. exports.generateUUID = generateUUID;