Example usage for org.apache.commons.math3.random BitsStreamGenerator nextLong

List of usage examples for org.apache.commons.math3.random BitsStreamGenerator nextLong

Introduction

In this page you can find the example usage for org.apache.commons.math3.random BitsStreamGenerator nextLong.

Prototype

public long nextLong() 

Source Link

Usage

From source file:cc.redberry.core.tensor.random.RandomTensor.java

/**
 * @param minDiffNDs     min number of different tensors
 * @param maxDiffNDs     max number of different tensors
 * @param minIndices     min number of indices in each tensor.
 * @param maxIndices     max number of indices in each tensor.
 * @param withSymmetries add symmetries to tensors
 *//*from   ww w .  ja  va 2  s  . com*/
public RandomTensor(int minDiffNDs, int maxDiffNDs, int[] minIndices, int[] maxIndices, boolean withSymmetries,
        BitsStreamGenerator random) {
    this.random = random;
    this.random.setSeed(seed = random.nextLong());
    this.minIndices = minIndices;
    this.maxIndices = maxIndices;
    this.withSymmetries = withSymmetries;
    int di = 1, t;
    for (int i = 0; i < TYPES.length; ++i)
        di *= (t = maxIndices[i] - minIndices[i]) == 0 ? 1 : t;
    this.diffStringNames = (maxDiffNDs - minDiffNDs) / di;
    namespace = new NameDescriptor[minDiffNDs + (int) (0.5 * (maxDiffNDs - minDiffNDs))];//TODO add randomization
    generateDescriptors(); //TOOD add weak reference to nameManager and regenerate at CC.resetTensorNames(....)
}