RandomExtensionMethods

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

Methods

CreateByteArray

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

CreateDoubleArray

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

CreateDoubleArray

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

CreateIntegerArray

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

CreateIntegerArray

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

NextBool

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

NextColour

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

NextDouble

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

NextPointInUnitSphere

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

NextPointOnUnitDisc

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

NextUnitVector2D

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

NextUnitVector3D

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

Pick<T>

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

ToColour

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