Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Starefossen/node-rand-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@starefossen/rand-path

Build status Codacy grade Codacy coverage NPM downloads NPM version Node version Dependency status

Dead simple random path generator.

Install

npm install @starefossen/rand-path --save

Usage

> var randPath = require('@starefossen/rand-path');
> randPath()
'wr/TB/s6'
> randPath(4)
'3J/P3/8K/y6'
> randPath(10, 3)
'6Szt/skob/vvay/ul23/6ceF/iX3O/ngU8/jKQU'

Test

npm test

Collision Probability

With the default alphabet of 62 characters, this random path generator has a 62^2n (where n is the depth of path) probability for a collision. With the default depth of 3 that is 1 in 56,800,235,584 chance.