Declaration
public static T PickRandom<T>(
this IEnumerable<T> src,
Random rnd = null
)
Summary
Returns a random element from the specified collection.
Generic type parameters
T |
The type of the elements in the collection. |
Parameters
this IEnumerable<T> | src |
The collection to pick from. |
Random | rnd |
Optionally, a random number generator to use. |
Returns
The element randomly picked.
Remarks
This method enumerates the entire input sequence into an array.