Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public final class Rng
- Object
- Rng
SplitMix64, the simulation’s only source of randomness.
Seeded from the level and the run, it yields the same sequence on every runtime, so an enemy that picks a random patrol turn picks the same one in a replay.
Constructors
public Rng(long seed) | Creates a generator. |
Methods
public long nextLong() | The next 64 random bits. |
public int nextInt(int bound) | A random whole number in [0, bound). |
public long state() | The generator’s state, folded into the world hash. |
Inherited methods
Constructor details
Rng
public Rng(long seed)Creates a generator.
Parameters
seedlong- the seed
Method details
nextLong
public long nextLong()The next 64 random bits.
Returns
a random
longnextInt
public int nextInt(int bound)A random whole number in
[0, bound).Parameters
boundint- the exclusive upper bound, positive
Returns
a random whole number
state
public long state()The generator’s state, folded into the world hash.
Returns
the internal state