The Inversive Congruential Generator is a non-linear pseudorandom number generator that uses modular multiplicative inversion. It uses the formula X(n+1) = (a * X(n)^(-1) + c) mod m, where X(n)^(-1) is the modular multiplicative inverse. ICG has better statistical properties than LCG but is computationally more expensive.
| Property | Value |
|---|---|
| Category | Random Number Generators |
| Sub-category | Pseudorandom Number Generator |
| Security status | π Educational Only |
| Complexity | Intermediate |
| Inventor | JΓΌrgen Eichenauer-Herrmann |
| Year | 1992 |
| Origin | π©πͺ Germany |
| Source | algorithms/random/icg.js |
| Parameter | Supported values |
|---|---|
| Seed sizes | 1 byte (8 bits) to 16 bytes (128 bits) |
| Flag | Value |
|---|---|
IsDeterministic |
Yes |
IsCryptographicallySecure |
No |
Status: π Educational Only
No vulnerabilities are recorded for this implementation.
3 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 β ICG with C# default parameters - seed=1, first 5 values
| Field | Value |
|---|---|
seed |
0000000000000001 |
multiplier |
5851f42d4c957f2d |
increment |
14057b7ef767814f |
modulo |
ffffffffffffffc5 |
outputSize |
40 |
input |
null |
expected |
6c576fac43fd007c26aa6283eb34dd79 b7bd4dc5927e304704b92c926378a484 e97a4a5839b3a1d9 |
Vector 2 β ICG with seed=0 (special case - returns increment)
| Field | Value |
|---|---|
seed |
0000000000000000 |
multiplier |
5851f42d4c957f2d |
increment |
14057b7ef767814f |
modulo |
ffffffffffffffc5 |
outputSize |
8 |
input |
null |
expected |
14057b7ef767814f |
Vector 3 β ICG with small modulus m=251 (prime), a=3, c=5, seed=7
| Field | Value |
|---|---|
seed |
07 |
multiplier |
03 |
increment |
05 |
modulo |
fb |
outputSize |
10 |
input |
null |
expected |
71415aa4e6dc0db378bb |