EnumerableRandomExtension
Contains extension methods for
System.Collections.Generic.IEnumerable`1.public static class EnumerableRandomExtensionInherits from System.Object
#Methods
#RandomElement<T>(IEnumerable<T>)
Returns a random element from
enumerable.public static T RandomElement<T>(this IEnumerable<T> enumerable)Type Parameters
TThe type of element inenumerable.
Parameters
enumerableIEnumerable<T>The collection to choose an item from.
Returns T: A random element in enumerable.
Exceptions
System.ArgumentExceptionThrown whenenumerablecontains no items.
This method uses System.Random to make a selection, which is
cryptographically insecure. This means that this method should not
be used for security-critical decisions.
Generated from Yarn Spinner for Unity 3.3.