|
static T | GetRandomElement< T > (this IList< T > collection) |
| Returns random element from the given collection with the scope of [first, last].
|
|
static T | GetRandomElementWithIndex< T > (this IList< T > collection, out int index) |
| Returns random element from the given collection with the scope of [first, last].
|
|
static T | Select< T > (params T[] values) |
| A convenient shorthand to select one of the provided values at random.
|
|
static IEnumerable< T > | GetElements< T > (this IList< T > collection, int num, bool unique=true) |
| Takes a specified number of elements from a collection.
|
|
static void | Shuffle< T > (this IList< T > list) |
| Shuffles the specified list in place using the Fisher-Yates algorithm.
|
|
static List< T > | GetShuffled< T > (this IList< T > list) |
| Returns a new list with the elements of the original list shuffled. The original list remains unchanged.
|
|
static List< T > | GetRandomSubcollection< T > (this IList< T > collection, int minLength, int maxLength) |
| Returns a random subcollection of a random length [min, max) from the given collection.
|
|
static bool | GetBool (float trueBias, float falseBias) |
| Returns random boolean based on true/false ratio. When they are equal (i.e. 1:1) results are uniformly spread. The larger the bias towards one value is, the more frequent it will appear in the output. No checks for non-zero denominator are performed.
|
|
static bool | GetBool (float minTrue=0.5f) |
| Returns random boolean based on the true threshold. The lower it is the more frequent true will appear in output.
|
|
static int | GetSign (float minPositive=0.5f) |
| If random [0-1] > 'minPositive' then +1 is returned, otherwise -1. The less 'minPositive' value is the higher the chance of getting +1 is.
|
|
static int | GetTernarSign () |
| Returns either -1, 0 or +1 with uniform distribution among the three.
|
|
static int | GetTernarSign (float negBias, float zeroBias, float posBias) |
| Returns random ternar sign (-1/0/1) based on true/false ratio. When they are equal (i.e. 1:1) results are uniformly spread. The larger the bias towards one value is, the more frequent it will appear in the output. No checks for non-zero denominator are performed.
|
|
static Vector2 | GetVector2D () |
| Generates a random Vector2 with values between -1 and 1.
|
|
static Vector2 | GetVector2D (float min, float max) |
| Generates a random Vector2 with values between min and max.
|
|
static Vector2 | GetVector2D (Vector2 min, Vector2 max) |
| Generates a random Vector2 with values between min and max.
|
|
static Vector3 | GetVector3D () |
| Generates a random Vector3 with values between -1 and 1.
|
|
static Vector3 | GetVector3D (float min, float max) |
| Generates a random Vector3 with values between min and max.
|
|
static Vector3 | GetVector3D (Vector3 min, Vector3 max) |
| Generates a random Vector3 with values between min and max.
|
|
static Vector4 | GetVector4D () |
| Generates a random Vector4 with values between -1 and 1.
|
|
static Vector4 | GetVector4D (float min, float max) |
| Generates a random Vector4 with values between min and max.
|
|
static Vector4 | GetVector4D (Vector4 min, Vector4 max) |
| Generates a random Vector4 with values between min and max.
|
|
static Vector2Int | GetVector2Int (int min, int max) |
| Generates a random Vector2Int with values between min (inclusive) and max (exclusive).
|
|
static Vector2Int | GetVector2Int (Vector2Int min, Vector2Int max) |
| Generates a random Vector2Int with values between min (inclusive) and max (exclusive).
|
|
static Vector3Int | GetVector3Int (int min, int max) |
| Generates a random Vector3Int with values between min (inclusive) and max (exclusive).
|
|
static Vector3Int | GetVector3Int (Vector3Int min, Vector3Int max) |
| Generates a random Vector3Int with values between min (inclusive) and max (exclusive).
|
|
static int | GetWeightedIndex (float[] segments, float sum) |
| Returns index of a segment which a random value fell into. Random value is generated [0-sum]. Larger segments naturally have higher result frequency than smaller ones. Used for controlled randomness ratios.
|
|
static int | GetWeightedIndex (float[] segments) |
| Returns index of a segment which a random value fell into. Random value is generated [0-sum]. Sum is calculated automatically. Larger segments naturally have higher result frequency than smaller ones. Used for controlled randomness ratios.
|
|
static Color | GetColorRGBOpaque () |
|
static Color | GetColorRGB () |
|
static Color | GetColorRGB (float min=0.5f, float max=0.9f) |
|
static Color | GetColorHSV () |
|
static Color | GetColorHSV (float hueMin, float hueMax) |
|
static Color | GetColorHSV (float hueMin, float hueMax, float saturationMin, float saturationMax) |
|
static Color | GetColorHSV (float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax) |
|
static Color | GetColorHSV (float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax, float alphaMin, float alphaMax) |
|
static Color | GetColorHSV (Color minColor, Color maxColor, bool invertHueRange=false) |
| Returns a random color between two colors in HSV space. Hue is overflown if hueMax overflows over the end of [0 - 1] range (is less than hueMin).
|
|
static Vector3 | GetPointOnSphere (float radius) |
|
static Vector3 | GetPointInSphere (float radius) |
|
static Vector2 | GetPointOnCircle (float radius, float maxAngle=2 *Mathf.PI) |
|
static Vector2 | GetPointInCircle (float radius, float maxAngle=2 *Mathf.PI) |
|
static Vector3 | GetPointInBounds (this Bounds bounds) |
|
static Vector2 | GetPointInRect (this Rect rect) |
|
static Quaternion | GetRotation2D () |
|
static T | GetEnumValue< T > () |
|
static char | GetRandomChar (this string str) |
| Gets a random character from the given string.
|
|
static string | GetRandomSubstring (this string str) |
| Gets a random substring of a random length from the given string.
|
|
static string | GetRandomSubstringOfLength (this string str, int length) |
| Gets a random substring of a specified length from the given string.
|
|
static string | GetRandomSubstringOfLength (this string str, int minLength, int maxLength) |
| Gets a random substring of a specified length from the given string.
|
|
static float | GetOverflownValue (float rangeMin, float rangeMax, float start, float end) |
| Returns a random value between min and max, but if max is less than min, it will overflow the value into the range [rangeMin - rangeMax].
|
|