Documentation
¶
Overview ¶
Package rng is the deterministic PRNG every random draw in the simulation routes through. It is a direct port of the engine's Mulberry32 generator: a tiny splittable PRNG with a single uint32 of state, adequate for aim jitter, target selection and particle offsets. Not cryptographic.
Determinism is the point — given the same seed and the same sequence of draws, the server and a wasm client produce identical results, which is what lets client-side prediction agree with the authoritative simulation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rng ¶
type Rng struct {
// contains filtered or unexported fields
}
Rng holds a single uint32 of Mulberry32 state.
func New ¶
New constructs an Rng from a seed. A zero seed degenerates to a fixed point at zero, so it is offset to the golden-ratio constant, matching the JS port.
func (*Rng) Fork ¶
Fork derives an independent child stream from this generator's next draw, so adding or removing one consumer does not perturb every other consumer's sequence.
func (*Rng) Next32 ¶
Next32 advances the generator and returns a raw uint32. Every other helper sits on top of this.