Class SimRandom
- Namespace
- SurvivorsMaker.Simulation
- Assembly
- SurvivorsMaker.Simulation.dll
Seeded random numbers that give the same sequence on every platform (xoshiro128**, seeded with splitmix32). The simulation uses only this, never System.Random or UnityEngine.Random.
public sealed class SimRandom
- Inheritance
-
SimRandom
- Inherited Members
Constructors
SimRandom(uint)
public SimRandom(uint seed)
Parameters
seeduint
Properties
State
Snapshot for save/replay.
public (uint, uint, uint, uint) State { get; set; }
Property Value
Methods
Chance(float)
True with the given probability (0–1).
public bool Chance(float probability)
Parameters
probabilityfloat
Returns
InsideCircle(float)
public Vec2 InsideCircle(float radius)
Parameters
radiusfloat
Returns
NextFloat()
0 (inclusive) to 1 (exclusive), 24-bit resolution.
public float NextFloat()
Returns
NextUInt()
public uint NextUInt()
Returns
PickWeighted(IReadOnlyList<float>)
Index chosen in proportion to the weights. Returns -1 when all weights are ≤ 0.
public int PickWeighted(IReadOnlyList<float> weights)
Parameters
weightsIReadOnlyList<float>
Returns
Pick<T>(IReadOnlyList<T>)
public T Pick<T>(IReadOnlyList<T> items)
Parameters
itemsIReadOnlyList<T>
Returns
- T
Type Parameters
T
Range(int, int)
min (inclusive) to max (exclusive). Returns min when max ≤ min.
public int Range(int min, int max)
Parameters
Returns
Range(float, float)
min (inclusive) to max (exclusive).
public float Range(float min, float max)
Parameters
Returns
Reseed(uint)
public void Reseed(uint seed)
Parameters
seeduint
Shuffle<T>(IList<T>)
public void Shuffle<T>(IList<T> items)
Parameters
itemsIList<T>
Type Parameters
T