randinitializebbs() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
void SRANDINITIALIZEBBS(rng_int_t *nbits, rng_int_t *lp, rng_int_t *p, rng_int_t *lq, rng_int_t *q, rng_int_t *ls, rng_int_t *s, rng_int_t *state, rng_int_t *lstate, rng_int_t *info)#
void DRANDINITIALIZEBBS(rng_int_t *nbits, rng_int_t *lp, rng_int_t *p, rng_int_t *lq, rng_int_t *q, rng_int_t *ls, rng_int_t *s, rng_int_t *state, rng_int_t *lstate, rng_int_t *info)#
void srandinitializebbs_(rng_int_t *nbits, rng_int_t *lp, rng_int_t *p, rng_int_t *lq, rng_int_t *q, rng_int_t *ls, rng_int_t *s, rng_int_t *state, rng_int_t *lstate, rng_int_t *info)#
void drandinitializebbs_(rng_int_t *nbits, rng_int_t *lp, rng_int_t *p, rng_int_t *lq, rng_int_t *q, rng_int_t *ls, rng_int_t *s, rng_int_t *state, rng_int_t *lstate, rng_int_t *info)#
void srandinitializebbs(rng_int_t nbits, rng_int_t lp, rng_int_t *p, rng_int_t lq, rng_int_t *q, rng_int_t ls, rng_int_t *s, rng_int_t *state, rng_int_t *lstate, rng_int_t *info)#
void drandinitializebbs(rng_int_t nbits, rng_int_t lp, rng_int_t *p, rng_int_t lq, rng_int_t *q, rng_int_t ls, rng_int_t *s, rng_int_t *state, rng_int_t *lstate, rng_int_t *info)#

Alternative initialisation routine for the Blum-Blum-Shub generator.

Parameters:
  • nbits[in]

    The number of bits to use from each iteration

    if

    nbits < 1, then nbits = 1

    ,

    if

    nbits > 15, then nbits = 15 (i.e. between 1 and 15 bits can be used)
  • lp[in] The number of digits in the first prime p, lp <= 25

  • p[in]

    The first prime value

    This integer is stored in an array.

    Each element of the array is a digit, and the integer is stored

    base B2, where B2 = 2**30, i.e.

    p = p(1) + p(2)*B2 + p(3)*B2**2 + … + p(lp)*B2**(lp-1), p(lp).

    p mod 4 = 3

  • lq[in] The number of digits in the second prime q, lq <= 25

  • q[in]

    The first prime value

    This integer is stored in an array.

    Each element of the array is a digit, and the integer is stored

    base B2, where B2 = 2**30, i.e.

    q = p(1) + q(2)*B2 + q(3)*B2**2 + … + q(lq)*B2**(lq-1), q(lq).

    q mod 4 = 3

  • ls[in] The number of digits in the initial state s, ls <= 25

  • s[in]

    The first prime value

    This integer is stored in an array.

    Each element of the array is a digit, and the integer is stored

    base B2, where B2 = 2**30, i.e.

    s = s(1) + s(2)*B2 + s(3)*B2**2 + … + s(lp)*B2**(ls-1), s(ls).
  • state[out]

    Array holding information about the generator:

    1 = Amount of state used = 310

    2 = ‘Magic’ number = 5010

    3 = GENID

    4 = SUBID (the number of bits to use)

    5 = PN, the location in state of N

    6 = PX, the location in state of X

    PX = LX, the number of digits of X

    PX+1 to PX+LX = The digits of X

    PN+1 to PN+LN = The digits of N

    310 = ‘Magic’ number = 5010
  • lstate[inout] Length of array state, lstate >= If lstate < 1, then lstate is set to 310 and the function returns.

  • info[out]

    Error code

    1 = Everything OK, but generator not initialized (returned when values of LSEED or lstate given)

    0 = Everything OK

    -1 to -8 = Error in parameter, abs(info).