Lines Matching defs:r

155  * @param r  The PRNG to mark as modified.
158 bc_rand_setModified(BcRNGData* r)
161 r->inc |= (BcRandState) 1UL;
163 r->inc.lo |= (uint_fast64_t) 1UL;
170 * @param r The PRNG to mark as not modified.
173 bc_rand_clearModified(BcRNGData* r)
176 r->inc &= ~((BcRandState) 1UL);
178 r->inc.lo &= ~(1UL);
278 * @param r The PRNG.
282 bc_rand_inc(BcRNGData* r)
287 inc = r->inc | 1;
289 inc.lo = r->inc.lo | 1;
290 inc.hi = r->inc.hi;
298 * @param r The PRNG whose increment will be set up.
301 bc_rand_setupInc(BcRNGData* r)
304 r->inc <<= 1UL;
306 r->inc.hi <<= 1UL;
307 r->inc.hi |= (r->inc.lo & (1UL << (BC_LONG_BIT - 1))) >> (BC_LONG_BIT - 1);
308 r->inc.lo <<= 1UL;
331 * @param r The return parameter; the PRNG to seed.
338 bc_rand_seedRNG(BcRNGData* r, ulong state1, ulong state2, ulong inc1,
341 bc_rand_seedState(&r->state, state1, state2);
342 bc_rand_seedState(&r->inc, inc1, inc2);
343 bc_rand_setupInc(r);
348 * @param r The PRNG.
353 bc_rand_fill(BcRNGData* r, BcRandUlong fulong, void* ptr)
363 bc_rand_seedRNG(r, state1, state2, inc1, inc2);
368 * @param r The PRNG.
371 bc_rand_step(BcRNGData* r)
373 BcRandState temp = bc_rand_mul2(r->state, bc_rand_multiplier);
374 r->state = bc_rand_add2(temp, bc_rand_inc(r));
379 * @param r The PRNG.
383 bc_rand_output(BcRNGData* r)
385 return BC_RAND_ROT(BC_RAND_FOLD(r->state), BC_RAND_ROTAMT(r->state));
391 * @param r The PRNG stack.
395 bc_rand_seedZeroes(BcRNG* r, BcRNGData* rng, size_t idx)
400 if (r->v.len <= idx) return;
403 rng2 = bc_vec_item_rev(&r->v, idx);
411 for (i = 1; i < r->v.len; ++i)
413 bc_rand_copy(bc_vec_item_rev(&r->v, i), rng);
463 * @param r The PRNG stack.
467 bc_rand_propagate(BcRNG* r, BcRNGData* rng)
470 if (r->v.len <= 1) return;
479 for (i = 1; go && i < r->v.len; ++i)
481 BcRNGData* rng2 = bc_vec_item_rev(&r->v, i);
489 bc_rand_seedZeroes(r, rng, i);
492 else bc_rand_seedZeroes(r, rng, 1);
496 bc_rand_int(BcRNG* r)
499 BcRNGData* rng = bc_vec_top(&r->v);
509 bc_rand_propagate(r, rng);
518 bc_rand_bounded(BcRNG* r, BcRand bound)
528 rand = bc_rand_int(r);
536 bc_rand_seed(BcRNG* r, ulong state1, ulong state2, ulong inc1, ulong inc2)
539 BcRNGData* rng = bc_vec_top(&r->v);
557 bc_rand_propagate(r, rng);
563 * @param r The PRNG.
568 bc_rand_getInc(BcRNGData* r)
573 res = r->inc >> 1;
575 res = r->inc;
585 bc_rand_getRands(BcRNG* r, BcRand* s1, BcRand* s2, BcRand* i1, BcRand* i2)
588 BcRNGData* rng = bc_vec_top(&r->v);
605 bc_rand_push(BcRNG* r)
607 BcRNGData* rng = bc_vec_pushEmpty(&r->v);
615 if (r->v.len > 1) bc_rand_copy(rng, bc_vec_item_rev(&r->v, 1));
619 bc_rand_pop(BcRNG* r, bool reset)
621 bc_vec_npop(&r->v, reset ? r->v.len - 1 : 1);
625 bc_rand_init(BcRNG* r)
628 bc_vec_init(&r->v, sizeof(BcRNGData), BC_DTOR_NONE);
629 bc_rand_push(r);
634 bc_rand_free(BcRNG* r)
637 bc_vec_free(&r->v);