ArrayExtensions.Random<T>

Extension Method in ArrayExtensions

Declaration

public static T Random<T>(this T[] array)

Description

Returns a random element from the array.

Type Parameters

TThe type of the array.

Parameters

arrayThe array to get the random element from.

Returns

TA random element from the array, or default(T) if the array is empty.