rand

rand generates cryptographically secure integers, bytes, alphanumeric strings and UUID v4 values, with an explicit MT mode for non-cryptographic workloads.

SecurityVersion 1.1.2Stable
lil-terminal

Overview

Use the default modes for tokens, random keys, temporary identifiers or other values that must be hard to predict. -mt exists for fast deterministic-style workloads and tests; it is deliberately separate from the secure generator.

Random does not always mean secret

Secure integers, bytes and strings use the cryptographic random source. A UUID is designed as an identifier, not a secret, and -mt can be reproducible when seeded, so MT output must not be used for passwords, access tokens or cryptographic keys.

Syntax

lil-terminal
rand [min [max]]

Reference

rand

generate a cryptographic integer from 0 to PHP_INT_MAX

rand <max>

generate a cryptographic integer from 0 to max

rand <min> <max>

generate a cryptographic integer in the selected range

rand -n <count> [min] [max]

generate several integers

rand -b <bytes>

generate cryptographic random bytes as hexadecimal

rand -s <length>

generate a cryptographic alphanumeric string

rand -uuid

generate an RFC 4122 version 4 UUID

rand -mt [min] [max]

generate a fast non-cryptographic integer

rand -mt -seed <integer>

seed the MT generator before generation

rand -max

show integer generator limits

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Show integer generator limits

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install rand
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install rand -m
Exact public version

Install exactly this published version.

install rand -v 1.1.2
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade rand
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install rand -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Show integer generator limits
rand -max | rand 1 100
secure  9223372036854775807
mt      2147483647

42
Generate several integers
rand -n 5 1 10
7f3d9a2c8e41b650
Generate a cryptographic alphanumeric string
rand -s 32
7f3d9a2c8e41b650
Generate an RFC 4122 version 4 UUID
rand -uuid
7f3d9a2c8e41b650
Rand · 05
rand 10 1
Minimum exceeds maximum

Related documentation

Current public release

v1.1.22026-08-11

First stable release

Current stable release of rand. rand generates cryptographically secure integers, bytes, alphanumeric strings and UUID v4 values, with an explicit MT mode for non-cryptographic workloads.