MCPcopy Create free account
hub / github.com/ddnet/ddnet / RandomBits

Method RandomBits

src/game/prng.cpp:43–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43unsigned int CPrng::RandomBits()
44{
45 dbg_assert(m_Seeded, "prng needs to be seeded before it can generate random numbers");
46
47 uint64_t x = m_State;
48 unsigned int Count = x >> 59;
49
50 static const uint64_t s_Multiplier = 6364136223846793005u;
51 m_State = x * s_Multiplier + m_Increment;
52 x ^= x >> 18;
53 return RotateRight32(x >> 27, Count);
54}

Callers 3

RandomOr0Method · 0.80
GeneratePassphraseMethod · 0.80
TESTFunction · 0.80

Calls 1

RotateRight32Function · 0.85

Tested by 1

TESTFunction · 0.64