Exemplo n.º 1
0
static inline unsigned long int
ran_get (void *vstate)
{
    ran_state_t *state = (ran_state_t *) vstate;

    const unsigned long int xtmp = state->x1;
    state->x1 = schrage_mult (AA1, state->x1, MM, CEIL_SQRT_MM)
                + schrage_mult (AA2, state->x0, MM, CEIL_SQRT_MM);

    if (state->x1 >= MM)
        state->x1 -= MM;

    state->x0 = xtmp;

    return state->x1;
}
Exemplo n.º 2
0
static inline unsigned long int
ran_get (void *vstate)
{
  ran_state_t *state = (ran_state_t *) vstate;

  state->x = schrage_mult (AA, state->x, MM, CEIL_SQRT_MM);

  return state->x;
}