Whetstone Class reference
Whetstone Class reference
Whetstone
WhetStone Namespaces
WhetStone.Random
pick Class
pick Methods
Pick Method
Pick(T) Method (IEnumerable(T), RandomGenerator)
Pick(T) Method (IList(T), RandomGenerator)
Pick(T) Method (IEnumerable(T), Int32, RandomGenerator)
Pick(T) Method (IList(T), Int32, RandomGenerator)
pick
Pick
T
Method (IEnumerable
T
, RandomGenerator)
Get a random element in an
IEnumerable
T
.
Namespace:
WhetStone.Random
Assembly:
WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntax
C#
Copy
public
static
T
Pick
<T>(
this
IEnumerable
<T>
this
,
RandomGenerator
gen
=
null
)
Parameters
this
Type:
System.Collections.Generic
IEnumerable
T
The
IEnumerable
T
to search in.
gen
(Optional)
Type:
WhetStone.Random
RandomGenerator
The
RandomGenerator
to use to roll for a random element.
for
GlobalRandomGenerator
.
Type Parameters
T
The type of the
IEnumerable
T
.
Return Value
Type:
T
A random element from
this
.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerable
T
. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic)
or
Extension Methods (C# Programming Guide)
.
Remarks
Running time: O(|
this
|)
See Also
Reference
pick Class
Pick Overload
WhetStone.Random Namespace