Previous: DRANDINITIALIZE, Up: Initialization of the Base Generators


DRANDINITIALIZEBBS / SRANDINITIALIZEBBS

Alternative initialization routine for the Blum-Blum-Shub generator. Unlike the other base generators supplied with the ACML, the Blum-Blum-Shub generator requires two additional parameters, p and q as well as an initial state, s. As p, q and s can be of an arbitrary size. In order to avoid overflow these values are expressed as a polynomial in B, where B=2^(24). For example, p can be factored into a polynomial of order l_p, with p = p_1 + p_2B + p_3B^2 + ... + p_(l_p) * B^(l_p-1), similarly q = q_1 + q_2B + q_3B^2 + ... + q_(l_q) * B^(l_q-1) and s = s_1 + s_2B + s_3B^2 + \cdots + s_(l_s) * B^(l_s-1).

(Note that SRANDINITIALIZEBBS is the single precision version of DRANDINITIALIZEBBS. The argument lists of both routines are identical except that any double precision arguments of DRANDINITIALIZEBBS are replaced in SRANDINITIALIZEBBS by single precision arguments - type REAL in FORTRAN or type float in C).

— SUBROUTINE: DRANDINITIALIZEBBS (NBITS,LP,P,LQ,Q,LS,S,STATE,LSTATE, INFO)
— Input: INTEGER NBITS

On input: the number of bits, v, to use from each iteration of the Blum-Blum-Shub generator. If NBITS<1 then NBITS=1. If NBITS>15 then NBITS=15.

— Input: INTEGER LP

On input: the order of the polynomial used to express p (l_p).
Constraint: 1 <=LP <=25.

— Input: INTEGER P(LP)

On input: the coefficients of the polynomial used to express p. P(i)=p_i, i=1 to l_p.
Constraint: 0 <=P (i) < 2^(24)

— Input: INTEGER LQ

On input: the order of the polynomial used to express q (l_q).
Constraint: 1 <=LQ <=25.

— Input: INTEGER Q(LQ)

On input: the coefficients of the polynomial used to express q. Q(i)=q_i, i=1 to l_q.
Constraint: 0 <=Q (i) < 2^(24)

— Input: INTEGER LS

On input: the order of the polynomial used to express s (l_s).
Constraint: 1 <=LS <=25.

— Input: INTEGER S(LS)

On input: the coefficients of the polynomial used to express s. S(i)=s_i, i=1 to l_s.
Constraint: 0 <=S (i) < 2^(24)

— Output: INTEGER STATE(*)

On output: the initial state for the Blum-Blum-Shub generator with parameters P,Q,S and NBITS.

— Input/Output: INTEGER LSTATE

On input: either the length of the state vector, STATE, or a value <=0 .
On output: if LSTATE<=0 on input, then LSTATE is set to the minimum length of the state vector STATE for the parameters chosen, and the routine returns. Otherwise LSTATE is left unchanged.
Constraint: LSTATE<=0 or LSTATE >=l_p+l_q+l_s+6

— Output: INTEGER INFO

On output: INFO is an error indicator. If INFO = -i on exit, the i-th argument had an illegal value. If INFO =1 on exit, then LSTATE has been set to the required length for the STATE vector. If INFO = 0 then the state vector, STATE, has been successfully initialized.