Description
Add default stream implementations to the sampler API interfaces
- ContinuousSampler - DoubleStream
- DiscreteSampler - IntStream
- LongSampler - LongStream
- ObjectSampler<T> - Stream<T>
e.g.
default DoubleStream samples() { return DoubleStream.generate(this::sample).sequential(); } default DoubleStream samples(long streamSize) { return samples().limit(streamSize); }
This allows for example:
UniformRandomProvider rng = ...;
double[] data = ContinuousUniformSampler.of(rng, 1.23, 4.56)
.samples(50)
.toArray();
Attachments
Issue Links
- is related to
-
RNG-176 Enhance the UniformRandomProvider interface with extra methods and default implementations
- Closed