KMRuleSeedable - Qkrisi/ktanemodkit GitHub Wiki

KMRuleSeedable

public class KMRuleSeedable : MonoBehaviour

Rule-seeding allows modules to have different rules when using a rule seed with the Rule Seed Modifier mod.


public MonoRandom GetRNG()

Get a MonoRandom object based on the rule seed.


[SerializeField]
private int _seed = 1;

(Unity Editor / TestHarness only) Indicates the rule seed in use.

MonoRandom

public class MonoRandom

An object with randomization methods used for rule-seeding. (Outside of KMRuleSeedable)


public MonoRandom(int seed)
public MonoRandom()

Initialies a new instance of MonoRandom using the specified seed or using a default seed value depending on the current time.


protected virtual double Sample()

Returns a random number between 0.0 and 1.0.


public T ShuffleFisherYates<T>(T list) where T : IList

Brings an array into random order using the Fisher-Yates shuffle.

This is an inplace algorithm, i.e. the input array is modified.


public virtual int Next()

Returns a nonnegative random number.


public virtual int Next(int maxValue)

Returns a nonnegative random number less than the specified maximum.


public virtual int Next(int minValue, int maxValue)

Returns a random number within a specified range. (minValue ≤ n < maxValue)


public virtual void NextBytes(byte[] buffer)

Fills the elements of a specified array of bytes with random numbers.


public virtual double NextDouble()

Returns a random number between 0.0 and 1.0.


public int Seed { get; private set; }

The specified seed