Tabnine Logo
RandomGenerator.nextLong
Code IndexAdd Tabnine to your IDE (free)

How to use
nextLong
method
in
org.apache.commons.math3.random.RandomGenerator

Best Java code snippets using org.apache.commons.math3.random.RandomGenerator.nextLong (Showing top 20 results out of 315)

origin: org.apache.commons/commons-math3

/**
 * {@inheritDoc}
 */
public synchronized long nextLong() {
  return wrapped.nextLong();
}
origin: apache/mahout

@Override
public long nextLong() {
 return random.nextLong();
}
origin: org.apache.commons/commons-math3

/**
 * Returns the next pseudorandom, uniformly distributed <code>long</code>
 * value from this random number generator's sequence.  All
 * 2<font size="-1"><sup>64</sup></font> possible {@code long} values
 * should be produced with (approximately) equal probability.
 *
 * @return  the next pseudorandom, uniformly distributed <code>long</code>
 *value from this random number generator's sequence
 */
@Override
public long nextLong() {
  return randomGenerator.nextLong();
}
origin: deeplearning4j/nd4j

@Override
public long nextLong() {
  return getRandomGenerator().nextLong();
}
origin: org.apache.commons/commons-math3

/** {@inheritDoc} */
public long nextSecureLong(final long lower, final long upper) throws NumberIsTooLargeException {
  if (lower >= upper) {
    throw new NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
                      lower, upper, false);
  }
  final RandomGenerator rng = getSecRan();
  final long max = (upper - lower) + 1;
  if (max <= 0) {
    // the range is too wide to fit in a positive long (larger than 2^63); as it covers
    // more than half the long range, we use directly a simple rejection method
    while (true) {
      final long r = rng.nextLong();
      if (r >= lower && r <= upper) {
        return r;
      }
    }
  } else if (max < Integer.MAX_VALUE){
    // we can shift the range and generate directly a positive int
    return lower + rng.nextInt((int) max);
  } else {
    // we can shift the range and generate directly a positive long
    return lower + nextLong(rng, max);
  }
}
origin: OryxProject/oryx

/**
 * Default implementation which randomly splits new data into train/test sets.
 * This handles the case where {@link #getTestFraction()} is not 0 or 1.
 *
 * @param newData data that has arrived in the current input batch
 * @return a {@link Pair} of train, test {@link RDD}s.
 */
protected Pair<JavaRDD<M>,JavaRDD<M>> splitNewDataToTrainTest(JavaRDD<M> newData) {
 RDD<M>[] testTrainRDDs = newData.rdd().randomSplit(
   new double[]{1.0 - testFraction, testFraction},
   RandomManager.getRandom().nextLong());
 return new Pair<>(newData.wrapRDD(testTrainRDDs[0]),
          newData.wrapRDD(testTrainRDDs[1]));
}
origin: org.apache.commons/commons-math3

/** {@inheritDoc} */
public long nextLong(final long lower, final long upper) throws NumberIsTooLargeException {
  if (lower >= upper) {
    throw new NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
                      lower, upper, false);
  }
  final long max = (upper - lower) + 1;
  if (max <= 0) {
    // the range is too wide to fit in a positive long (larger than 2^63); as it covers
    // more than half the long range, we use directly a simple rejection method
    final RandomGenerator rng = getRandomGenerator();
    while (true) {
      final long r = rng.nextLong();
      if (r >= lower && r <= upper) {
        return r;
      }
    }
  } else if (max < Integer.MAX_VALUE){
    // we can shift the range and generate directly a positive int
    return lower + getRandomGenerator().nextInt((int) max);
  } else {
    // we can shift the range and generate directly a positive long
    return lower + nextLong(getRandomGenerator(), max);
  }
}
origin: io.virtdata/virtdata-lib-realer

/**
 * {@inheritDoc}
 */
public synchronized long nextLong() {
  return wrapped.nextLong();
}
origin: geogebra/geogebra

/**
 * {@inheritDoc}
 */
public synchronized long nextLong() {
  return wrapped.nextLong();
}
origin: com.github.rinde/rinsim-problem

public static ImmutableList<Long> generateDistinct(RandomGenerator rng,
  int size) {
 final Set<Long> numbers = newLinkedHashSet();
 while (numbers.size() < size) {
  numbers.add(rng.nextLong());
 }
 return ImmutableList.copyOf(numbers);
}
origin: com.github.rinde/rinsim-experiment

static ImmutableList<Long> generateDistinct(RandomGenerator rng, int size) {
 final Set<Long> numbers = newLinkedHashSet();
 while (numbers.size() < size) {
  numbers.add(rng.nextLong());
 }
 return ImmutableList.copyOf(numbers);
}
origin: cc.redberry/rings

/**
 * Returns a random element from this ring
 *
 * @param rnd the source of randomness
 * @return random element from this ring
 */
public long randomElement(RandomGenerator rnd) {
  return modulus(rnd.nextLong());
}
origin: rinde/RinSim

@Override
public long getSeed() {
 stateCheck();
 return masterRandomGenerator.nextLong();
}
origin: rinde/RinSim

 static double getValue(StochasticSupplier<Double> ed, RandomGenerator rng) {
  final double sample = ed.get(rng.nextLong());
  checkArgument(
   sample >= 0d,
   "A StochasticSupplier used in a TimeSeries may not return negative "
    + "values, was: %s.",
   sample);
  return sample;
 }
}
origin: rinde/RinSim

 static SineIntensity create(SineIntensityBuilder b, long seed) {
  final RandomGenerator rng = new MersenneTwister(seed);
  final double amplitude = b.amplitudeSup.get(rng.nextLong());
  final double frequency = b.frequencySup.get(rng.nextLong());
  final double height = b.heightSup.get(rng.nextLong());
  final double phaseShift = b.phaseShiftSup.get(rng.nextLong());
  return new AutoValue_IntensityFunctions_SineIntensity(amplitude,
   frequency, height, phaseShift);
 }
}
origin: rinde/RinSim

 @Override
 public ImmutableList<Double> generate(long seed) {
  rng.setSeed(seed);
  final TimeSeriesGenerator tsg = new NonHomogenous(length,
   lambdSup.get(rng.nextLong()));
  return tsg.generate(rng.nextLong());
 }
}
origin: rinde/RinSim

 @Override
 public RandomGenerator sharedInstance(Class<?> clazz) {
  stateCheck();
  if (!classRngMap.containsKey(clazz)) {
   final RandomGenerator rng = new UnmodifiableRandomGenerator(
    new MersenneTwister(masterRandomGenerator.nextLong()));
   classRngMap.put(clazz, rng);
   return rng;
  }
  return classRngMap.get(clazz);
 }
}
origin: cc.redberry/core

NameManager(Long seed, String kronecker, String metric) {
  if (seed == null) {
    random = new Well44497b();
    random.setSeed(this.seed = random.nextLong());
  } else
    random = new Well44497b(this.seed = seed);
  kroneckerAndMetricNames[0] = kronecker;
  kroneckerAndMetricNames[1] = metric;
}
origin: rinde/RinSim

static void assertAlwaysEquals(LocationGenerator lg) {
 final RandomGenerator rng = new MersenneTwister(123);
 final List<Point> points = lg.generate(rng.nextLong(), 2);
 for (int i = 0; i < 5; i++) {
  final List<Point> points2 = lg.generate(rng.nextLong(), 2);
  assertEquals(points, points2);
 }
}
origin: com.github.rinde/rinlog

@Override
public void handleTimedEvent(AddVehicleEvent event,
  SimulatorAPI simulator) {
 final RoutePlanner rp =
  getRoutePlanner().get(simulator.getRandomGenerator()
   .nextLong());
 final Communicator c =
  getCommunicator().get(simulator.getRandomGenerator()
   .nextLong());
 simulator.register(new Truck(event.getVehicleDTO(), rp, c,
  getRouteAdjuster(), getLazyComputation()));
}
org.apache.commons.math3.randomRandomGeneratornextLong

Javadoc

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. All 264 possible long values should be produced with (approximately) equal probability.

Popular methods of RandomGenerator

  • nextInt
    Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified valu
  • nextDouble
    Returns the next pseudorandom, uniformly distributeddouble value between 0.0 and 1.0 from this rando
  • setSeed
    Sets the seed of the underlying random number generator using anint array seed. Sequences of values
  • nextBoolean
    Returns the next pseudorandom, uniformly distributedboolean value from this random number generator'
  • nextFloat
    Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this rand
  • nextGaussian
    Returns the next pseudorandom, Gaussian ("normally") distributeddouble value with mean 0.0 and stand
  • nextBytes
    Generates random bytes and places them into a user-supplied byte array. The number of random bytes p
  • <init>

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • setScale (BigDecimal)
  • Kernel (java.awt.image)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JTable (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now