Returns a random hypercube using a rouleteWheel method.

@param randomGenerator the {@link BoundedRandomGenerator} to use for the roulette

@return the number of the selected hypercube.
501595
public int rouletteWheel(BoundedRandomGenerator<Double> randomGenerator) {
    //Calculate the inverse sum
    double inverseSum = 0.0;
    for (int hypercube : hypercubes) {
      if (hypercube > 0) {
        inverseSum += 1.0 / (double) hypercube;
      }
    }

    //Calculate a random value between 0 and sumaInversa
    double random = randomGenerator.getRandomValue(0.0, inverseSum);
    int hypercube = 0;
    double accumulatedSum = 0.0;
    while (hypercube < hypercubes.length) {
      if (hypercubes[hypercube] > 0) {
        accumulatedSum += 1.0 / (double) hypercubes[hypercube];
      }

      if (accumulatedSum > random) {
        return hypercube;
      }

      hypercube++;
    }

    return hypercube;
  }
59094
public static int randomIntBetween(int min, int max) {
    Random rand = new Random();
    return rand.nextInt((max - min) + 1) + min;
  }
1338314
public static double getRandomDouble(double min, double max) {
		Random r = new Random();
		return min + (max - min) * r.nextDouble();
	}
206181
public T random() {

        long randomNum =
            ThreadLocalRandom.current().nextLong(
                toProlepticNumber(this.t1),
                toProlepticNumber(this.t2) + 1);
        return fromProlepticNumber(randomNum);

    }
590072
public static <S> PAreaBIGenerator<S> create()
  {
    return new PAreaBIGenerator<>(new Generator<BigInteger>()
    {
      private final Random random = new Random();

      @Override
      public BigInteger next()
      {
        return BigInteger.valueOf(Math.abs(this.random.nextLong()));
      }
    });
  }
1371128
public double[] randSphere(int dimension) {
    int D = dimension;
    double[] x = new double[dimension];

    double length = 0;
    for (int i = 0; i < dimension; i++) {
      x[i] = 0.0;
    }

    // --------- Step 1. Direction

    for (int i = 0; i < D; i++) {
      x[i] = this.randNormal(0, 1);
      length += length + x[i] * x[i];
    }

    length = Math.sqrt(length);

    // --------- Step 2. Random radius

    double r = randomGenerator.nextDouble(0, 1);

    for (int i = 0; i < D; i++) {
      x[i] = r * x[i] / length;
    }

    return x;
  }
995042
public static RealMatrix shuffleRows (RealMatrix matrix, RandomGenerator randomGenerator) {
        // Create an index vector to be shuffled:
        int[] index = MathArrays.sequence(matrix.getRowDimension(), 0, 1);
        MathArrays.shuffle(index, randomGenerator);

        // Create a new matrix:
        RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension());

        // Populate:
        for (int row = 0; row < index.length; row++) {
            retval.setRowVector(row, matrix.getRowVector(index[row]));
        }

        // Done, return:
        return retval;
    }
1286826
public int[] getRandomNextPermutation() {
        int d = maxRank - currentRank;
        int r = this.random.nextInt(d);
        this.currentRank += Math.max(1, r);
        return this.getCurrentPermutation();
    }
1031583
public static int getRandomNumber(int min, int max) {
		Random r = new Random();
		return r.nextInt(max - min + 1) + min;
	}
1082312
public static void randomize(
        MutableDoubleTuple t, double min, double max, Random random)
    {
        double delta = max - min;
        for (int i=0; i<t.getSize(); i++)
        {
            t.set(i, min + random.nextDouble() * delta);
        }
    }
654032
public static Ordering shuffledBy(final Random random) {
        return new Ordering() {
            @Override
            boolean validateOrderingIsCorrect() {
                return false;
            }

            @Override
            protected List<Description> orderItems(Collection<Description> descriptions) {
                List<Description> shuffled = new ArrayList<Description>(descriptions);
                Collections.shuffle(shuffled, random);
                return shuffled;
            }
        };
    }
1370983
@Override
    public StreamT<W,T> shuffle(final Random random) {

        return (StreamT<W,T>) FoldableTransformerSeq.super.shuffle(random);
    }
766323
public Biomorph generateRandomCandidate(Random rng)
    {
        int[] genes = new int[Biomorph.GENE_COUNT];
        for (int i = 0; i < Biomorph.GENE_COUNT - 1; i++)
        {
            // First 8 genes have values between -5 and 5.
            genes[i] = rng.nextInt(11) - 5;
        }
        // Last genes ha a value between 1 and 7.
        genes[Biomorph.LENGTH_GENE_INDEX] = rng.nextInt(Biomorph.LENGTH_GENE_MAX) + 1;
        return new Biomorph(genes);
    }
32878
public int getRandomInt() {
    	
        Integer newInt = null;
        do {
        	newInt = randomGenerator.nextInt();
        } while(this.previousRandomInts.contains(newInt));
        this.previousRandomInts.add(newInt);
        return newInt.intValue();
    }
971473
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator, RandomGenerator<Double> randomGenerator) {
    return getBestSolution(solution1, solution2, comparator, (a, b) -> randomGenerator.getRandomValue() < 0.5 ? a : b);
  }
769771
@Override
    public INDArray rand(int[] shape, org.nd4j.linalg.api.rng.Random r) {
        INDArray ret = r.nextDouble(shape);
        return ret;
    }
969133
public static double[] zmbd(double[] lower, double[] upper, RandomGenerator randomGenerator) {
        return DMatrixUtils.zmbd(lower, upper, 0.0, randomGenerator);
    }