Example usage for org.apache.commons.math.random RandomDataImpl nextUniform

List of usage examples for org.apache.commons.math.random RandomDataImpl nextUniform

Introduction

In this page you can find the example usage for org.apache.commons.math.random RandomDataImpl nextUniform.

Prototype

public double nextUniform(double lower, double upper) 

Source Link

Document

Algorithm Description: scales the output of Random.nextDouble(), but rejects 0 values (i.e., will generate another random double if Random.nextDouble() returns 0).

Usage

From source file:datafu.pig.hash.lsh.p_stable.AbstractStableDistributionFunction.java

public void reset(int dim, double w) throws MathException {
    RandomDataImpl dataSampler = new RandomDataImpl(rg);
    Sampler sampler = getSampler();/* w ww . j  a v a  2s.  c om*/
    this.a = new double[dim];
    this.dim = dim;
    this.w = w;
    for (int i = 0; i < dim; ++i) {
        a[i] = sampler.sample(dataSampler);
    }
    b = dataSampler.nextUniform(0, w);
}