rndid
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

RNDID

A package for generating random unique(ish) IDs

Installation

$ yarn add rndid

or if your still use npm

$ npm install rndid --save

Usage

let rndid = require('rndid');
 
// generate a random 32 bit number between 15203654 and 98880000
let num = rndid.randomNumber(15203654, 98880000);
 
// generate a random hex string of 20 bytes
let hex = rndid.bytes(20, 'hex');
 
// etc...

API

randomNumber

generate random 32 bit numbers within a certain range

Parameters

randomInt64

generate a random 64 bit integer - returns a string due to JavaScript limitations

bytes

Parameters

  • num number the number of bytes to generate
  • encoding string encoding format of the returned string

ksuid

generate a KSUID

Parameters

  • seconds seconds with with which to generate KSUID

uuid

generate UUID v4

Package Sidebar

Install

npm i rndid

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • mofax