MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SeedRef

Method SeedRef

engine/Random/randomGen.cpp:87–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87int RandomTable::SeedRef(int x, int z) const
88{
89 // slow reference implementation
90 // make x, z out of order
91 enum
92 {
93 mask = Size - 1
94 };
95 // bitwise interleave x and z
96 int xz = 0;
97 // only 12 bits is significant
98 x = _table[x & mask];
99 z = _table[z & mask];
100
101 for (int i = 0; i < 6; i++)
102 {
103 xz <<= 1, xz |= x & 1, x >>= 1;
104 xz <<= 1, xz |= z & 1, z >>= 1;
105 }
106
107 return xz;
108}
109
110const int A = 48271;
111const int M = 0x7fffffff;

Callers 2

GetSeedRefMethod · 0.80
test_randomGen.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected