MCPcopy Create free account
hub / github.com/F-Stack/f-stack / init_gen_rand

Function init_gen_rand

app/redis-6.2.6/deps/jemalloc/test/src/SFMT.c:607–630  ·  view source on GitHub ↗

* This function initializes the internal state array with a 32-bit * integer seed. * * @param seed a 32-bit integer used as the seed. */

Source from the content-addressed store, hash-verified

605 * @param seed a 32-bit integer used as the seed.
606 */
607sfmt_t *init_gen_rand(uint32_t seed) {
608 void *p;
609 sfmt_t *ctx;
610 int i;
611 uint32_t *psfmt32;
612
613 if (posix_memalign(&p, sizeof(w128_t), sizeof(sfmt_t)) != 0) {
614 return NULL;
615 }
616 ctx = (sfmt_t *)p;
617 psfmt32 = &ctx->sfmt[0].u[0];
618
619 psfmt32[idxof(0)] = seed;
620 for (i = 1; i < N32; i++) {
621 psfmt32[idxof(i)] = 1812433253UL * (psfmt32[idxof(i - 1)]
622 ^ (psfmt32[idxof(i - 1)] >> 30))
623 + i;
624 }
625 ctx->idx = N32;
626 period_certification(ctx);
627 ctx->initialized = 1;
628
629 return ctx;
630}
631
632/**
633 * This function initializes the internal state array,

Callers 5

SFMT.cFile · 0.85
TEST_BEGINFunction · 0.85
ph.cFile · 0.85
rb.cFile · 0.85
TEST_BEGINFunction · 0.85

Calls 2

idxofFunction · 0.85
period_certificationFunction · 0.85

Tested by

no test coverage detected