XOR4096 is an extremely long-period pseudo-random number generator from Richard P. Brent’s xorgens collection. With a 4096-bit state and period of 2^4096-1, it uses optimized shift parameters (10,5,26) discovered through exhaustive computer search. Fast, high-quality, and passes all known statistical tests.
| Property | Value |
|---|---|
| Category | Random Number Generators |
| Sub-category | Deterministic PRNG |
| Security status | 🎓 Educational Only |
| Complexity | Intermediate |
| Inventor | Richard P. Brent |
| Year | 2004 |
| Origin | 🇦🇺 Australia |
| Source | algorithms/random/xor4096.js |
| Parameter | Supported values |
|---|---|
| Seed sizes | 1 byte (8 bits) to 512 bytes (4096 bits) |
| Flag | Value |
|---|---|
IsDeterministic |
Yes |
IsCryptographicallySecure |
No |
Status: 🎓 Educational Only
No vulnerabilities are recorded for this implementation.
5 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 — Seed 1: First 5 outputs (20 bytes) - verified against Brent’s reference implementation
| Field | Value |
|---|---|
seed |
00000001 |
outputSize |
20 |
input |
null |
expected |
089eaa881d5742ddf5b78d625de54033af1c7c78 |
Vector 2 — Seed 123456789: First 10 outputs (40 bytes) - standard test seed from xorshift family
| Field | Value |
|---|---|
seed |
075bcd15 |
outputSize |
40 |
input |
null |
expected |
931360141ca802da2e1922b83bd4c75f d92146850761dd89c0adad51a2f80516 6b42fe0289f8b997 |
Vector 3 — Seed 1: Outputs 129-133 (after full state cycle) - verifies long-term behavior
| Field | Value |
|---|---|
seed |
00000001 |
outputSize |
20 |
skip |
128 |
input |
null |
expected |
5ce606bd5f71294fb248669f81be1f1a204c25da |
Vector 4 — Seed 0xDEADBEEF: First 8 outputs - common test pattern
| Field | Value |
|---|---|
seed |
deadbeef |
outputSize |
32 |
input |
null |
expected |
fc6e5a0b67b3d5ab3d28388cd17fe586d3b5bad2eced1f247e3d0c9579326db9 |
Vector 5 — Seed 0x12345678: First 6 outputs - sequential pattern test
| Field | Value |
|---|---|
seed |
12345678 |
outputSize |
24 |
input |
null |
expected |
21447db60360f65b55634bd7a9bb83b2314d866d6030269a |