randomStableSample(count:)

Randomly selects the specified number of elements from this collection, maintaining their relative order.

RandomSample.swift:98
func randomStableSample(count k: Int) -> [Element]

Parameters

k

The number of elements to randomly select.

Returns

An array of k random elements. If k is greater than this collection’s count, then this method returns the full collection.

This method is equivalent to calling randomStableSample(k:using:), passing in the system’s default random generator.