get Random Subset
Returns a random subset of the specified size from the set, with selection probability based on weights. The subset will contain unique elements and always be of the requested size.
Parameters
size
The number of unique elements to select.
random
An optional Random instance to use for selection. Defaults to ThreadLocalRandom.
Throws
if size is negative or exceeds the number of elements in the set.