@thetally/rand
v1.1.0
Published
A random data generator utility
Maintainers
Readme
@thetally/rand
A command-line random data generator utility that provides various types of random data generation.
CLI
Installation
Install globally with npm:
npm install -g @thetally/randUsage
rand <command> [args...]Commands
uuid4- Generate a random UUID v4hex <length>- Generate a random hex string of given lengthbase62 <length>- Generate a random base62 string of given lengthbase64 <length>- Generate a random base64 string of given lengthbase64url <length>- Generate a random base64url string of given lengthdec <length>- Generate a random decimal string of given lengthoct <length>- Generate a random octal string of given lengthbin <length>- Generate a random binary string of given lengthint <max>- Generate a random integer from 0 to max-1password <length>- Generate a random password (A-Za-z0-9!@#$%^&*)help- Show help message
Flags
-B- Interpret length as bytes instead of characters-b- Interpret length as bits instead of characters
Examples
# Generate a UUID
rand uuid4
# Generate a 32-character hex string
rand hex 32
# Generate a 16-character password
rand password 16
# Generate a random integer between 0 and 99
rand int 100
# Generate 64 bits of binary data
rand bin 64 -bPackage
Installation
Install with npm:
npm install @thetally/randUsage
import {
randomPassword,
randomHex,
randomBase64,
randomBase64Url,
randomBase62,
randomDecimal,
randomOctal,
randomBinary,
randomIntMax,
uuid4
} from '@thetally/rand';
const uuid = uuid4()
const randomHex = randomHex(100) // length of 100License
ISC
