randomval
Generate random values.
Installation
npm install randomval --save
Usage
#!/usr/bin/env/node const randomval = // ------------------------// Random Bool// ------------------------console //-> trueconsole //-> trueconsole //-> true // ------------------------// Random Date// ------------------------console //-> Mon Nov 28 2016 04:50:44 GMT+0900 (JST)console //-> Mon Nov 07 2016 20:27:57 GMT+0900 (JST)console //-> Sun Nov 27 2016 10:53:39 GMT+0900 (JST) // ------------------------// Random Hash// ------------------------console //-> 8d2a76c0e7b04bb690c7a17bfe7d03c5console //-> 613a056fd107413e9b6787a6055d78edconsole //-> bd1b3f70b4f4466d87cf0dda704936b7 // ------------------------// Random Int// ------------------------console //-> 1423455250182315console //-> -7677881246134615console //-> -380459522751636 // ------------------------// Random// ------------------------console //-> 0.46031310883760845console //-> 0.24084973502152018console //-> 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.