Skip to content

okunishinishi/node-randomval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

randomval

Build Status Code Climate Code Coverage npm Version

Generate random values.

Installation

npm install randomval --save

Usage

#!/usr/bin/env/node

const randomval = require('randomval')

// ------------------------
// Random Bool
// ------------------------
console.log(randomval.randomBool()) //-> true
console.log(randomval.randomBool()) //-> true
console.log(randomval.randomBool()) //-> true


// ------------------------
// Random Date
// ------------------------
console.log(randomval.randomDate()) //-> Mon Nov 28 2016 04:50:44 GMT+0900 (JST)
console.log(randomval.randomDate()) //-> Mon Nov 07 2016 20:27:57 GMT+0900 (JST)
console.log(randomval.randomDate()) //-> Sun Nov 27 2016 10:53:39 GMT+0900 (JST)


// ------------------------
// Random Hash
// ------------------------
console.log(randomval.randomHash()) //-> 8d2a76c0e7b04bb690c7a17bfe7d03c5
console.log(randomval.randomHash()) //-> 613a056fd107413e9b6787a6055d78ed
console.log(randomval.randomHash()) //-> bd1b3f70b4f4466d87cf0dda704936b7


// ------------------------
// Random Int
// ------------------------
console.log(randomval.randomInt()) //-> 1423455250182315
console.log(randomval.randomInt()) //-> -7677881246134615
console.log(randomval.randomInt()) //-> -380459522751636


// ------------------------
// Random
// ------------------------
console.log(randomval.random()) //-> 0.46031310883760845
console.log(randomval.random()) //-> 0.24084973502152018
console.log(randomval.random()) //-> 0.01482755843377448

API Guide

Signature Description
.random() Random number between 0 and 1
.randomBool() Random boolean. (true or false)
.randomInt() Random integer value
.randomInt(min, max) Random integer value in range
.randomHash() Random hash string
.randomHash(len) Random hash string with length
.randomDate() Random date
.randomDate(min, max) Random date in range

License

This software is released under the MIT License.

Links

About

Node.js module to generate random value.

Resources

License

Stars

Watchers

Forks

Packages

No packages published