RandomExtended..::..Choose<(Of <(<'T>)>)> Method (IReadOnlyList<(Of <(<'T>)>)>, Int32, Boolean)

Choose count items from the list, leaving the original list unaltered.

Namespace:  Tortuga.Anchor
Assembly:  Tortuga.Anchor (in Tortuga.Anchor.dll)

Syntax


public List<T> Choose<T>(
	IReadOnlyList<T> list,
	int count,
	bool allowDuplicates
)
Public Function Choose(Of T) ( _
	list As IReadOnlyList(Of T), _
	count As Integer, _
	allowDuplicates As Boolean _
) As List(Of T)

Type Parameters

T

Parameters

list
Type: IReadOnlyList<(Of <(<'T>)>)>
The list.
count
Type: Int32
The count.
allowDuplicates
Type: Boolean
if set to true is the same item can be picked multiple times.

Return Value

Exceptions


ExceptionCondition
[ArgumentNullException]list;list is null.
[ArgumentOutOfRangeException] count;count must be greater than or equal to zero or count;count must be less than or equal to list.Count if allowDuplicates is false