MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Rand32

Function Rand32

MicropolisCore/src/CellEngine/src/cellengine.cpp:148–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146
147
148long Rand32()
149{
150 PrimeRandoms();
151
152 randomRead++;
153 if (randomRead >= RANDOMS_COUNT) {
154 randomRead = 0;
155 }
156
157 long result = randoms[randomRead];
158
159 // TODO: make a better hasher
160#ifdef MACOS
161 randoms[randomRead] ^= Random();
162#else
163 int r = rand() ^ (rand() << 8);
164 randoms[randomRead] ^= r;
165#endif
166
167 return result;
168}
169
170
171long Rand16()

Callers 2

Rand16Function · 0.70
Rand8Function · 0.70

Calls 1

PrimeRandomsFunction · 0.70

Tested by

no test coverage detected