RandomExtensionMethods

public static class RandomExtensionMethods
Provides extension methods for the Random class.

Methods

CreateByteArray

#Example
public static byte[] CreateByteArray(this Random random, int length)
Create an array of random bytes.
random (Random)Random instance.
length (int)Length of array.

CreateDoubleArray

#Example
public static double[] CreateDoubleArray(this Random random, int length, double min, double max)
Create an array of random 64-bit floats.
random (Random)Random instance.
length (int)Length of array.
min (double)Inclusive minimum.
max (double)Exclusive maximum.

CreateDoubleArray

#Example
public static double[] CreateDoubleArray(this Random random, int length)
Create an array of random 64-bit floats in the unit interval.
random (Random)Random instance.
length (int)Length of array.

CreateIntegerArray

#Example
public static int[] CreateIntegerArray(this Random random, int length, int min, int max)
Create an array of random 32-bit integers.
random (Random)Random instance.
length (int)Length of array.
min (int)Inclusive minimum.
max (int)Exclusive maximum.

CreateIntegerArray

#Example
public static int[] CreateIntegerArray(this Random random, int length)
Create an array of random 32-bit integers.
random (Random)Random instance.
length (int)Length of array.

NextBool

#Example
public static bool NextBool(this Random random)
Generate a random boolean value.
random (Random)Random engine.
Random bool.

NextColour

#Example
public static Color NextColour(this Random random, bool randomAlpha = false)
Generate a random colour.
random (Random)Random engine.
randomAlpha (bool = false)If true, the alpha channel will also be randomized.
Random colour.

NextDouble

#Example
public static double NextDouble(this Random random, double min, double max)
Generate a double in the given interval.
random (Random)Random instance.
min (double)Minimum value.
max (double)Maximum value.

NextPointInUnitSphere

#Example
public static Point3d NextPointInUnitSphere(this Random random)
Create a random, three-dimensional point inside the unit-sphere.
random (Random)

NextPointOnUnitDisc

#Example
public static Point2d NextPointOnUnitDisc(this Random random)
Create a random, three-dimensional point on the unit disc.
random (Random)

NextUnitVector2D

#Example
public static Vector2d NextUnitVector2D(this Random random)
Create a random, two-dimensional unit vector.
random (Random)Random engine.

NextUnitVector3D

#Example
public static Vector3d NextUnitVector3D(this Random random)
Create a random, three-dimensional unit vector.
random (Random)Random engine.

Pick<T>

#Example
public static T Pick<T>(this Random random, T[] array)
Pick a random element from an array.
random (Random)
array (T[])

ToColour

#Example
public static Color ToColour(this DistributionType type)
Create the colour associated with a distribution.
type (DistributionType)