T - Type of items in the collection.public class CollectionSampler<T> extends Object
Collection.| Constructor and Description |
|---|
CollectionSampler(UniformRandomProvider rng,
Collection<T> collection)
Creates a sampler.
|
| Modifier and Type | Method and Description |
|---|---|
T |
sample()
Picks one of the items from the
collection passed to the constructor. |
public CollectionSampler(UniformRandomProvider rng, Collection<T> collection)
rng - Generator of uniformly distributed random numbers.collection - Collection to be sampled.
A (shallow) copy will be stored in the created instance.IllegalArgumentException - if collection is empty.public T sample()
collection passed to the constructor.Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.