Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uuid-random

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid-random

Fastest UUIDv4 with good RNG

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
176K
decreased by-9.31%
Maintainers
1
Weekly downloads
 
Created
Source

uuid-random

Generate random UUIDv4 with better statistical dispersion than Math.random().

Install

npm install uuid-random

Performance

This is the fastest pure javascript UUIDv4 generator I have found, almost 5x faster than comparable libraries.

npm packageperformance
uuid370k ops/sec
node-uuid370k ops/sec
uuid-random1.618M ops/sec

Yep, the golden ratio.

Features

  • 0.3k minified + gzipped
  • Uses better RNG when possible
  • Works in browser or node
  • Very fast!

Example Usage

Node

var uuid = require('uuid-random');
uuid(); // '0b99b82f-62cf-4275-88b3-de039020f14e'

Browser

<script src="uuid-random.min.js"></script>
<script>
  uuid(); // 'b96ab5e6-f1e8-4653-ab08-4dd82ea65778'
</script>

Rationale

Math.random() sucks for uuid generation.

After digging through npm and stackoverflow, I settled on using node-uuid to take advantage of better RNG when possible.

I wasn't happy with the solution so I combined code from the best libs and researched a much faster, more compact version that still used the best RNG available to the platform.

This library does one thing very well: generate UUIDv4 (random).

License

MIT

Keywords

FAQs

Package last updated on 16 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc