Make It Random User's Manual

Version History |

Version 2.0

An update focusing on non-uniform distribution sampling.

- Added distribution sampling, with initial support for continuous sampling from the following:
- uniform distribution
- triangular distribution
- trapezoidal distribution
- linear distribution
- Hermite spline distribution
- normal distribution
- exponential distribution
- piecewise uniform distribution
- piecewise linear distribution
- piecewise Hermite spline distribution

- Added some common color categories for generating random colors, such as bold, pastel, somber, warm, and cool.

- Changed the elementCount parameter order for RandomListAccess.WeightedIndex(...) for better consistency and flexibility.
- MIRandom.CreateStandard(...) functions now return IRandom instead of XorShift128Plus.
- MIRandom.CreateStandard(...) functions may return an instance of some engine type other than XorShift128Plus, depending on the platform and compiler defines.

- Control flow in RandomGeometry.Rotation() tweaked so that the updated compiler in Unity 5.5 will not complain about an unset out parameter.
- Fixed the version 0.1 backward-compatible code path for seeding XorShift128Plus so that it works in both the Complete and Basic edition by not depending on the existence of SplitMix64.
- Corrected the version 0.1 backward-compatible code path for RandomGeometry.UnitVector2() to do the proper math instead of calling itself repeatedly and cause a stack overflow.

- Added missing float and double overloads for RandomListAccess.WeightedElement(...).

- Improved weighted list index generation to only generate a single random value, instead of one per each weight.
- Improved pre-computed weighted list index generation to operate in O(log n) time instead of O(n), by storing a cumulative weight sum array and performing a binary search on it.
- Provided additional overloads for weighted list index/element generation to specify a subset of weights to use, convenient for manually resized arrays that may have more elements than are currently used.
- Added WeightedRandomIndex and WeightedRandomElement extension functions for IListT.
- Random engines now support equality comparisons, which check that both type and internal state are equal.
- Parameter requirements for RandomInteger.RangeCO(...) using unsigned types loosened; an upper exclusive value of 0 will now generate a value within the entire range of the unsigned integer type.

- Added a distribution sampling demo scene.
- The shuffle and weighted index generation demo will now repeatedly select new indices at a configurable frequency.
- The random colors demo allows a more flexible method of generating colors from a selected color category.

Version 1.0

The initial release.

- IRandom interface
- Random state generator
- Random generator pattern
- MIRandom static helper class
- Range bound inclusivity naming pattern

- XorShift128+
- XorShift1024*
- XoroShiro128+
- XorShiftAdd
- SplitMix64
- UnityEngineRandom wrapper
- SystemRandom wrapper