BREAKING NEWS
Inversive congruential generator

## Summary

Inversive congruential generators are a type of nonlinear congruential pseudorandom number generator, which use the modular multiplicative inverse (if it exists) to generate the next number in a sequence. The standard formula for an inversive congruential generator, modulo some prime q is:

 ${\displaystyle x_{0}=}$ seed ${\displaystyle x_{i+1}\equiv (ax_{i}^{-1}+c)\mod q}$ if ${\displaystyle x_{i}\neq 0}$ ${\displaystyle x_{i+1}=c}$ if ${\displaystyle x_{i}=0}$

Such a generator is denoted symbolically as ICG(q,a,c,seed) and is said to be an ICG with parameters q,a,c and seed seed.

## Period

The sequence ${\displaystyle (x_{n})_{n\geq 0}}$ must have ${\displaystyle x_{i}=x_{j}}$ after finitely many steps and since the next element depends only on its direct predecessor also ${\displaystyle x_{i+1}=x_{j+1}}$ etc. The maximum length that the period T for a function modulo q can have is T=q. If the polynomial ${\displaystyle f(x)=x^{2}-cx-a\in \mathbb {F} _{q}[x]}$ (polynomial ring over ${\displaystyle \mathbb {F} _{q}}$) is primitive, then the sequence will have the maximum length. Such polynomials are called inversive maximal period (IMP) polynomials. The sufficient condition for maximum sequence period is a proper choice of parameters a and c according to the algorithm described in.[1] Eichenauer-Herrmann, Lehn, Grothe and Niederreiter have shown that inversive congruential generators have good uniformity properties, in particular with regard to lattice structure and serial correlations.

## Example

ICG(5,2,3,1) gives the sequence:(1,0,3,2,4,1,.....) (as in ${\displaystyle \in \mathbb {F} _{5}}$, 1 and 4 are their own inverse, 2 is the inverse of 3 and conversely). In this example ${\displaystyle f(x)=x^{2}-3x-2}$ is irreducible in ${\displaystyle \mathbb {F} _{5}[x]}$ as neither 0,1,2,3 or 4 are roots, and therefore the period is equal to q=5.In order to show that f is primitive one should show that x is a primitive element of ${\displaystyle \mathbb {F} _{5}[x]/(f)}$.

## Compound Inversive Generator

The construction of a Compound Inversive Generator (CIG) relies on combining two or more congruential inversive generators according to the method described below.

Let ${\displaystyle p_{1},\dots ,p_{r}}$ be distinct prime integers, each ${\displaystyle p_{j}\geq 5}$. For each index j,1≤ j ≤ r, let ${\displaystyle (x_{n})_{n\geq 0}}$ be a sequence of elements of ${\displaystyle \in \mathbb {F} _{p_{j}}}$, that is periodic with period length ${\displaystyle p_{j}}$. In other words,${\displaystyle \{x_{n}^{(j)}|0\leq n\leq p_{j}\}=\in \mathbb {F} _{p_{j}}}$.

For each index j, 1≤ j ≤ r, we consider ${\displaystyle T_{j}=T/p_{j}}$ where ${\displaystyle T=p_{1}\cdots p_{r}}$ is the period length of the following sequence ${\displaystyle (x_{n})_{n\geq 0}}$.

The sequence ${\displaystyle (x_{n})_{n\geq 0}}$ of compound pseudorandom numbers is defined as the sum

${\displaystyle x_{n}=T_{1}x_{n}^{(1)}+T_{2}x_{n}^{(2)}+\dots +T_{r}x_{n}^{(r)}\mod T}$.

The compound approach allows combining Inversive Congruential Generators, provided they have full period, in parallel generation systems.

## Example

Let ${\displaystyle p_{1}=5}$ and ${\displaystyle p_{2}=7(r=2)}$. To simplify, take ${\displaystyle (x_{n}^{(1)})_{n\geq 0}=(0,1,2,3,4,\dots )}$ and ${\displaystyle (x_{n}^{(2)})_{n\geq 0}=(0,1,2,3,4,5,6,\dots )}$. We compute for every 1≤ j≤ 35, ${\displaystyle x_{j}=7x_{j}^{(1)}+5x_{j}^{(2)}\mod 35}$ then ${\displaystyle (x_{n})_{n\geq 0}=(0,12,24,1,13,25,2,14,26,3,15,27,4,16,28,5,17,29,6,18,30,7,19,31,8,20,32,9,21,33,10,22,34,11,23)}$ (we have to do the 35 different sums to obtain 0+0 and we begin the same sequence again, the period is ${\displaystyle 5\times 7=35\,}$). This method allows obtaining very long period and modular operations may be carried out with relatively small moduli.

The CIG are accepted for practical purposes for a number of reasons.

Firstly, binary sequences produced in this way are free of undesirable statistical deviations. Inversive sequences extensively tested with variety of statistical tests remain stable under the variation of parameter.[2][3][4]

Secondly, there exists a steady and simple way of parameter choice, based on the Chou algorithm [1] that guarantees maximum period length.

Thirdly, compound approach has the same properties as single inversive generators [5][6] but it also provides period length significantly greater than obtained by a single Inversive Congruential Generator. They seem to be designed for application with multiprocessor parallel hardware platforms.

There exists an algorithm [7] which allows designing compound generators with predictable period length, predictable linear complexity level, with excellent statistical properties of produced bit streams.

The procedure of designing this complex structure starts with defining finite field of p elements and ends with choosing the parameters a and c for each Inversive Congruential Generator being the component of the compound generator. It means that each generator is associated to a fixed IMP polynomial. Such a condition is sufficient for maximum period of each Inversive Congruential Generator[8] and finally for maximum period of the compound generator. The construction of IMP polynomials is the most efficient approach to find parameters for Inversive Congruential Generator with maximum period length.

## Discrepancy and its boundaries

Equidistribution and statistical independence properties of the generated sequences, which are very important for their usability in a stochastic simulation, can be analyzed based on the discrepancy of s-tuples of successive pseudorandom numbers with ${\displaystyle s=1}$ and ${\displaystyle s=2}$ respectively.

The discrepancy computes the distance of a generator from a uniform one, a low discrepancy means that the sequence generated can be used for cryptographic purposes and the first aim of the Inversive congruential generator is to provide pseudorandom numbers.

## Definition

For N arbitrary points ${\displaystyle {\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1}\in [0,1)}$ the discrepancy is defined by ${\displaystyle D_{N}({\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1})={\rm {sup}}_{J}|F_{N}(J)-V(J)|}$, where the supremum is extended over all subintervals J of ${\displaystyle [0,1)^{s}}$, ${\displaystyle F_{N}(J)}$ is ${\displaystyle N^{-1}}$ times the number of points among ${\displaystyle {\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1}}$ falling into J and ${\displaystyle V(J)}$ denotes the s-dimensional volume of J.

Until now, we had sequences of integers from 0 to ${\displaystyle T-1}$, in order to have sequences of ${\displaystyle [0,1)^{s}}$, one can divide a sequences of integers by its period T.

From this definition, we can say that if the sequence ${\displaystyle {\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1}}$ is perfectly random then its well distributed on the interval ${\displaystyle J=[0,1)^{s}}$ then ${\displaystyle V(J)=1}$ and all points are in J so ${\displaystyle F_{N}(J)=N/N=1}$ hence ${\displaystyle D_{N}({\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1})=0}$ but instead if the sequence is concentrated close to one point then the subinterval J is very small ${\displaystyle V(j)\approx 0}$ and ${\displaystyle F_{N}(j)\approx N/N\approx 1}$ so ${\displaystyle D_{N}({\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1})=1}$ Then we have from the better and worst case:

${\displaystyle 0\leq D_{N}({\mathbf {t} }_{1},\dots ,{\mathbf {t} }_{N-1})\leq 1}$.

## Notations

Some further notation is necessary. For integers ${\displaystyle k\geq 1}$ and ${\displaystyle q\geq 2}$ let ${\displaystyle C_{k}(q)}$ be the set of nonzero lattice points ${\displaystyle (h_{1},\dots ,h_{k})\in Z^{k}}$ with ${\displaystyle -q/2 for ${\displaystyle 1\leq j\leq k}$.

Define

${\displaystyle r(h,q)={\begin{cases}q\sin(\pi |h|/q)&{\text{for }}h\in C_{1}(q)\\1&{\text{for }}h=0\end{cases}}}$

and

${\displaystyle r(\mathbf {h} ,q)=\prod _{j=1}^{k}r(h_{j},q)}$

for ${\displaystyle {\mathbf {h} }=(h_{1},\dots ,h_{k})\in C_{k}(q)}$. For real ${\displaystyle t}$ the abbreviation ${\displaystyle e(t)={\rm {exp}}(2\pi \cdot it)}$ is used, and ${\displaystyle u\cdot v}$ stands for the standard inner product of ${\displaystyle u,v}$ in ${\displaystyle R^{k}}$.

## Higher bound

Let ${\displaystyle N\geq 1}$ and ${\displaystyle q\geq 2}$ be integers. Let ${\displaystyle {\mathbf {t} }_{n}=y_{n}/q\in [0,1)^{k}}$ with ${\displaystyle y_{n}\in \{0,1,\dots ,q-1\}^{k}}$ for ${\displaystyle 0\leq n.

Then the discrepancy of the points ${\displaystyle {\mathbf {t} }_{0},\dots ,{\mathbf {t} }_{N-1}}$ satisfies

${\displaystyle D_{N}(\mathbf {t} _{0},\mathbf {t} _{1},\dots ,\mathbf {t} _{N-1})}$${\displaystyle {\frac {k}{q}}}$ + ${\displaystyle {\frac {1}{N}}}$ ${\displaystyle \sum _{h\in \mathbb {C} _{k}(q)}}$${\displaystyle {\frac {1}{r(\mathbf {h} ,q)}}{\Bigg |}\sum _{n=0}^{N-1}e(\mathbf {h} \cdot \mathbf {t} _{n}){\Bigg |}}$

## Lower bound

The discrepancy of ${\displaystyle N}$ arbitrary points ${\displaystyle \mathbf {t} _{1},\dots ,\mathbf {t} _{N-1}\in [0,1)^{k}}$ satisfies

${\displaystyle D_{N}(\mathbf {t} _{0},\mathbf {t} _{1},\dots ,\mathbf {t} _{N-1})\geq {\frac {\pi }{2N((\pi +1)^{l}-1)\prod _{j=1}^{k}{\rm {max}}(1,h_{j})}}{\Bigg |}\sum _{n=0}^{N-1}e(\mathbf {h} \cdot \mathbf {t} _{n}){\Bigg |}}$

for any nonzero lattice point ${\displaystyle {\mathbf {h} }=(h_{1},\dots ,h_{k})\in Z^{k}}$, where ${\displaystyle l}$ denotes the number of nonzero coordinates of ${\displaystyle {\mathbf {h} }}$.

These two theorems show that the CIG is not perfect because the discrepancy is greater strictly than a positive value but also the CIG is not the worst generator as the discrepancy is lower than a value less than 1.

There exist also theorems which bound the average value of the discrepancy for Compound Inversive Generators and also ones which take values such that the discrepancy is bounded by some value depending on the parameters. For more details see the original paper.[9]

3. ^ J. Eichenauer-Herrmannn, H. Grothe, A. Topuzoglu, On the lattice structure of a nonlinear generator with modulus ${\displaystyle 2^{\alpha }}$, J.Comput. Appl. Math., Vol. 31,1990, pp. 81-85.