美文网首页
生成uuid

生成uuid

作者: WWWWWWWWWWWWWWM | 来源:发表于2021-04-01 10:18 被阅读0次
        function uuid (hasHyphen) {
  return (hasHyphen ? 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' : 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx').replace(/[xy]/g, function (c) {
        const r = Math.random() * 16 | 0
        const v = c == 'x' ? r : (r & 0x3 | 0x8)
        return v.toString(16)
  })
}

相关文章

网友评论

      本文标题:生成uuid

      本文链接:https://www.haomeiwen.com/subject/syttkltx.html