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

Method Seed

engine/Random/randomGen.cpp:25–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25int RandomTable::Seed(int x, int z, int y) const
26{
27 // make x, z out of order
28 const int mask = Size - 1;
29 x = _table[x & mask];
30 z = _table[z & mask];
31 y = _table[y & mask];
32 // bitwise interleave x, z, and y
33 int xz = 0;
34 // only 12 bits is significant
35 xz <<= 1, xz |= x & 1, x >>= 1;
36 xz <<= 1, xz |= z & 1, z >>= 1;
37 xz <<= 1, xz |= y & 1, y >>= 1;
38
39 xz <<= 1, xz |= x & 1, x >>= 1;
40 xz <<= 1, xz |= z & 1, z >>= 1;
41 xz <<= 1, xz |= y & 1, y >>= 1;
42
43 xz <<= 1, xz |= x & 1, x >>= 1;
44 xz <<= 1, xz |= z & 1, z >>= 1;
45 xz <<= 1, xz |= y & 1, y >>= 1;
46
47 xz <<= 1, xz |= x & 1, x >>= 1;
48 xz <<= 1, xz |= z & 1, z >>= 1;
49 xz <<= 1, xz |= y & 1, y >>= 1;
50 return xz;
51}
52
53int RandomTable::Seed(int x, int z) const
54{

Callers 2

GetSeedMethod · 0.80
test_randomGen.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected