Example usage for org.apache.commons.math3.distribution RealDistribution reseedRandomGenerator

List of usage examples for org.apache.commons.math3.distribution RealDistribution reseedRandomGenerator

Introduction

In this page you can find the example usage for org.apache.commons.math3.distribution RealDistribution reseedRandomGenerator.

Prototype

void reseedRandomGenerator(long seed);

Source Link

Document

Reseed the random generator used to generate samples.

Usage

From source file:org.apache.beam.sdk.io.synthetic.SyntheticOptions.java

public static Sampler fromRealDistribution(final RealDistribution dist) {
    return new Sampler() {
        private static final long serialVersionUID = 0L;

        @Override//from   w w  w . j  a  v a  2  s.c  om
        public double sample(long seed) {
            dist.reseedRandomGenerator(seed);
            return dist.sample();
        }

        @Override
        public Object getDistribution() {
            return dist;
        }
    };
}