@Override public boolean nextBoolean() { return random.nextBoolean(); }
/** * {@inheritDoc} */ public synchronized boolean nextBoolean() { return wrapped.nextBoolean(); }
/** * Returns the next pseudorandom, uniformly distributed * <code>boolean</code> value from this random number generator's * sequence. * * @return the next pseudorandom, uniformly distributed * <code>boolean</code> value from this random number generator's * sequence */ @Override public boolean nextBoolean() { return randomGenerator.nextBoolean(); }
@Override public boolean nextBoolean() { return getRandomGenerator().nextBoolean(); }
@Override public Pair<String,String> generate(int id, RandomGenerator random) { List<String> elements = new ArrayList<>(n + 2); elements.add(Integer.toString(id)); int count = 0; for (int i = 0; i < n; i++) { boolean positive = random.nextBoolean(); elements.add(positive ? "A" : "B"); if (positive) { count++; } } elements.add(Integer.toString(count)); return new Pair<>(Integer.toString(id), TextUtils.joinDelimited(elements, ',')); }
@Override public Pair<String,String> generate(int id, RandomGenerator random) { return new Pair<>(Integer.toString(id), id + "," + random.nextInt(100) + ',' + random.nextBoolean() + ',' + random.nextGaussian()); }
/** * {@inheritDoc} */ public synchronized boolean nextBoolean() { return wrapped.nextBoolean(); }
/** * {@inheritDoc} */ public synchronized boolean nextBoolean() { return wrapped.nextBoolean(); }
/** * Returns the next pseudorandom, uniformly distributed * <code>boolean</code> value from this random number generator's * sequence. * * @return the next pseudorandom, uniformly distributed * <code>boolean</code> value from this random number generator's * sequence */ @Override public boolean nextBoolean() { return randomGenerator.nextBoolean(); }
@Override public boolean nextBoolean() { return random.nextBoolean(); }
/** * Returns the next pseudorandom, uniformly distributed * <code>boolean</code> value from this random number generator's * sequence. * * @return the next pseudorandom, uniformly distributed * <code>boolean</code> value from this random number generator's * sequence */ @Override public boolean nextBoolean() { return randomGenerator.nextBoolean(); }
@Override public boolean nextBoolean() { return delegateRng.nextBoolean(); }
@Override public boolean nextBoolean() { return getRandomGenerator().nextBoolean(); }
public Tensor nextTensorTree(int depth, Parameters parameters, Indices indices) { return nextTensorTree(random.nextBoolean() ? TensorType.Product : TensorType.Sum, depth, parameters, indices); }
public boolean nextBoolean() { return randomDataGenerator.getRandomGenerator().nextBoolean(); }
public boolean nextBoolean() { return randomDataGenerator.getRandomGenerator().nextBoolean(); }
/** * Creates random array of length {@code degree + 1} with elements bounded by {@code bound} (by absolute value). * * @param degree polynomial degree * @param bound absolute bound for coefficients * @param rnd random source * @return array of length {@code degree + 1} with elements bounded by {@code bound} (by absolute value) */ public static long[] randomLongArray(int degree, long bound, RandomGenerator rnd) { long[] data = new long[degree + 1]; RandomDataGenerator rndd = new RandomDataGenerator(rnd); for (int i = 0; i <= degree; ++i) { data[i] = rndd.nextLong(0, bound - 1); if (rnd.nextBoolean() && rnd.nextBoolean()) data[i] = -data[i]; } while (data[degree] == 0) data[degree] = rndd.nextLong(0, bound - 1); return data; }
/** * Moves the vehicle to a point on the border of the plane. */ public void setInactive() { if (active) { active = false; final List<Point> bounds = rm.get().getBounds(); final Point p = rm.get().getRandomPosition(rng); if (rng.nextBoolean()) { doSetDestination(new Point(bounds.get(rng.nextInt(2)).x, p.y)); } else { doSetDestination(new Point(p.x, bounds.get(rng.nextInt(2)).y)); } } } }
/** * Moves the vehicle to a point on the border of the plane. */ public void setInactive() { if (active) { active = false; final List<Point> bounds = rm.get().getBounds(); final Point p = rm.get().getRandomPosition(rng); if (rng.nextBoolean()) { doSetDestination(new Point(bounds.get(rng.nextInt(2)).x, p.y)); } else { doSetDestination(new Point(p.x, bounds.get(rng.nextInt(2)).y)); } } } }
/** * Creates random array of length {@code degree + 1} with elements bounded by {@code bound} (by absolute value). * * @param degree polynomial degree * @param bound absolute bound for coefficients * @param rnd random source * @return array of length {@code degree + 1} with elements bounded by {@code bound} (by absolute value) */ public static BigInteger[] randomBigArray(int degree, BigInteger bound, RandomGenerator rnd) { long lBound = bound.isLong() ? bound.longValue() : Long.MAX_VALUE; RandomDataGenerator rndd = new RandomDataGenerator(rnd); BigInteger[] data = new BigInteger[degree + 1]; for (int i = 0; i <= degree; ++i) { data[i] = RandomUtil.randomInt(bound, rnd); if (rnd.nextBoolean() && rnd.nextBoolean()) data[i] = data[i].negate(); } while (data[degree].equals(BigInteger.ZERO)) data[degree] = BigInteger.valueOf(rndd.nextLong(0, lBound)); return data; }