| 35 | constexpr int kTap = 12800; // 5 taps x 2560 |
| 36 | |
| 37 | float tap_value(uint32_t lineage, int64_t pos, int i) { |
| 38 | uint32_t x = (uint32_t) pos * 2654435761u ^ (uint32_t) i * 40503u ^ lineage * 97531u; |
| 39 | x ^= x >> 15; x *= 2246822519u; x ^= x >> 13; x *= 3266489917u; x ^= x >> 16; |
| 40 | return ((float) (x & 0xFFFF) / 32768.0f - 1.0f) * (1.0f + 0.25f * (float) (i % 7)); |
| 41 | } |
| 42 | |
| 43 | // feeds the rows [from, to) of `lineage` (tokens: token_of(lineage, pos)) as context updates, 256 rows a call, and notes the tokens |
| 44 | int32_t token_of(uint32_t lineage, int64_t pos) { return (int32_t) (1000 + ((uint32_t) pos * 7919u + lineage * 104729u) % 50000u); } |