Python offers both sampling with replacement (every value is independent) and sampling without replacement (each value can't occur again in the same call). I think these are pretty useful; there's a lot of examples where you need to sample without replacement, like drawing card hands, and writing such a sampling function can be a bit annoying.
Do we want to add such a function? Python's method is
random.sample(items, numSamples, counts=None)
where counts is an optional array, of the same length as items, that lets you manually specify how many times each item should be considered to be in the collection. (So you don't have to manually repeat the item the specified number of times.)
I suspect we'd want to take the counts value as an options bag, like Random.sample(items, num, {counts}).
Python offers both sampling with replacement (every value is independent) and sampling without replacement (each value can't occur again in the same call). I think these are pretty useful; there's a lot of examples where you need to sample without replacement, like drawing card hands, and writing such a sampling function can be a bit annoying.
Do we want to add such a function? Python's method is
where
counts
is an optional array, of the same length asitems
, that lets you manually specify how many times each item should be considered to be in the collection. (So you don't have to manually repeat the item the specified number of times.)I suspect we'd want to take the
counts
value as an options bag, likeRandom.sample(items, num, {counts})
.