RandomArray

Random generator for array objects.

Description

The RandomArray class can be used as a random generator for array objects.

Static methods

Pick

Picks a random element from specified array. T - the class type

public static T Pick<T>(T[] values)

  • values: T[] - an array of any type
  • returns: T - a randomly picked item.

Pick

Picks a random element from specified list. T - the class type

public static T Pick<T>(List<T> values)

  • values: List<T> - an array of any type
  • returns: T - a randomly picked item.

Examples

var value1 = RandomArray.Pick(new int []{1, 2, 3, 4}); // Possible result: 3