crypto.randomUUID([options])


  • options <Object>
    • disableEntropyCache <boolean> 默认情况下,为了提高性能,Node.js 会生成并缓存足够多的随机数据,以生成多达 128 个随机 UUID。 要在不使用缓存的情况下生成 UUID,请将 disableEntropyCache 设置为 true默认值: false
  • 返回: <string>

生成随机的 RFC 4122 版本 4 UUID。 UUID 是使用加密伪随机数生成器生成的。

  • options <Object>
    • disableEntropyCache <boolean> By default, to improve performance, Node.js generates and caches enough random data to generate up to 128 random UUIDs. To generate a UUID without using the cache, set disableEntropyCache to true. Default: false.
  • Returns: <string>

Generates a random RFC 4122 version 4 UUID. The UUID is generated using a cryptographic pseudorandom number generator.