capid

1.0.0 • Public • Published

capid

Stability: 3 - Stable

Capability Unique Identifier generator.

Contributors

@tristanls

Usage

var capid = require('capid');
var id = capid(); // returns Buffer

Overview

Given N number of possible identifiers and n random choices of identifiers, the expected number of choosing the same identifier at random is given by the formula n * (1 - (1 - 1/N)^(n-1)).

Let N = 2^336 (42 bytes).

Let n = 1e48 id's created. (for comparison: 4e20 is the number of milliseconds since the beginning of the Universe (13.8 billion years); 1e41 is the number of events you'd get if every millisecond since the beginning of the Universe generated 4e20 events).

The expected number of randomly assigning the same identifier for n = 1e48 and N = 2^336 is 0.000714.

Sources

Readme

Keywords

none

Package Sidebar

Install

npm i capid

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • tristanls