Click or drag to resize
Accord.NET (logo)

VectorSample Method (Int16)

Returns a vector containing indices (0, 1, 2, ..., n - 1) in random order. The vector grows up to to size, but does not include size among its values.

Namespace:  Accord.Math
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public static short[] Sample(
	short size
)
Request Example View Source

Parameters

size
Type: SystemInt16
The size of the sample vector to be generated.

Return Value

Type: Int16
Examples
var a = Vector.Sample(3);  // a possible output is { 2, 1, 0 };
var b = Vector.Sample(10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };

foreach (var i in Vector.Sample(5))
{
   // ...
}
See Also