/** * Returns a {@code Stream} of randomly sampled {@link DynamicAssignment}s. * @param nSequences an {@code int} that represents the number of sequences. * @param sequenceLength an {@code int} that represents the length of each sequence. * @return a {@code Stream} of randomly sampled {@link DynamicAssignment}s. */ private Stream<DynamicAssignment> getSampleStream(int nSequences, int sequenceLength) { LocalRandomGenerator randomGenerator = new LocalRandomGenerator(seed); return IntStream.range(0,nSequences).mapToObj(Integer::new) .flatMap(i -> sample(network, causalOrderTime0, causalOrderTimeT, randomGenerator.current(), i, sequenceLength)); }