//core/io.github.serpro69.kfaker/IRandom/randomSubset
randomSubset¶
[jvm]\ abstract fun <T> randomSubset(set: Set<T>, size: Int = 0, shuffled: Boolean = false): Set<T>
Returns a portion of the set with pseudo-randomly generated fromIndex
and (possibly) toIndex
values.
Parameters¶
jvm
size | the desired size of the resulting set. If size <= 0 then toIndex will also be randomly-generated. |
shuffled | if true the set will be shuffled before extracting the subset |
[jvm]\ abstract fun <T> randomSubset(set: Set<T>, sizeRange: IntRange, shuffled: Boolean = false): Set<T>
Returns a portion of the set with pseudo-randomly generated fromIndex
and (possibly) toIndex
values.
Parameters¶
jvm
sizeRange | the desired size range of the resulting list. The size of the returned list is the result of calling nextInt with the sizeRange. IF size <= 0 then toIndex will also be randomly-generated. |
shuffled | if true the set will be shuffled before extracting the subset |