ListExtensions.Random<T>

Extension Method in ListExtensions

Declaration

public static T Random<T>(this List<T> list)

Description

Returns a random item from the list.

Type Parameters

TThe type of the list.

Parameters

listThe list to get the random item from.

Returns

TA random item from the list, or default(T) if the list is empty.