MCPcopy Create free account
hub / github.com/numpy/numpy / add_state

Function add_state

numpy/random/src/mt19937/mt19937-jump.c:44–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void add_state(mt19937_state *state1, mt19937_state *state2) {
45 int i, pt1 = state1->pos, pt2 = state2->pos;
46
47 if (pt2 - pt1 >= 0) {
48 for (i = 0; i < N - pt2; i++)
49 state1->key[i + pt1] ^= state2->key[i + pt2];
50 for (; i < N - pt1; i++)
51 state1->key[i + pt1] ^= state2->key[i + (pt2 - N)];
52 for (; i < N; i++)
53 state1->key[i + (pt1 - N)] ^= state2->key[i + (pt2 - N)];
54 } else {
55 for (i = 0; i < N - pt1; i++)
56 state1->key[i + pt1] ^= state2->key[i + pt2];
57 for (; i < N - pt2; i++)
58 state1->key[i + (pt1 - N)] ^= state2->key[i + pt2];
59 for (; i < N; i++)
60 state1->key[i + (pt1 - N)] ^= state2->key[i + (pt2 - N)];
61 }
62}
63
64/* compute pf(ss) using standard Horner method */
65void horner1(unsigned long *pf, mt19937_state *state) {

Callers 1

horner1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected