org.deeplearning4j.clustering.util

## Class MathUtils

• ```public class MathUtils
extends Object```
This is a math utils class.
Author:
• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `log2`
The natural logarithm of 2.
`static double` `SMALL`
The small deviation allowed in double comparisons.
• ### Constructor Summary

Constructors
Constructor and Description
`MathUtils()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```adjustedrSquared(double rSquared, int numRegressors, int numDataPoints)```
This calculates the adjusted r^2 including degrees of freedom.
`static double` ```bernoullis(double n, double k, double successProb)```
This will return the bernoulli trial for the given event.
`static int` ```binomial(org.apache.commons.math3.random.RandomGenerator rng, int n, double p)```
Generates a binomial distributed number using the given rng
`org.apache.commons.math3.linear.CholeskyDecomposition` `choleskyFromMatrix(org.apache.commons.math3.linear.RealMatrix m)`
This will return the cholesky decomposition of the given matrix
`static int` ```clamp(int value, int min, int max)```
Clamps the value to a discrete value
`static double` ```combination(double n, double r)```
This returns the combination of n choose r
`static List<double[]>` `coordSplit(double[] vector)`
This returns the coordinate split in a list of coordinates such that the values for ret are the x values and ret are the y values
`static List<double[]>` `coordSplit(List<Double> vector)`
This returns the coordinate split in a list of coordinates such that the values for ret are the x values and ret are the y values
`static double` ```correlation(double[] residuals, double[] targetAttribute)```
Returns the correlation coefficient of two double vectors.
`static double` ```determinationCoefficient(double[] y1, double[] y2, int n)```
This returns the determination coefficient of two vectors given a length
`static int` ```discretize(double value, double min, double max, int binCount)```
Discretize the given value
`static int` `distanceFinderZValue(double[] vector)`
This will translate a vector in to an equivalent integer
`static double` `entropy(double[] vector)`
This returns the entropy (information gain, or uncertainty of a random variable).
`static double` ```errorFor(double actual, double prediction)```
`static double` ```euclideanDistance(double[] p, double[] q)```
This returns the distance of two vectors sum(i=1,n) (q_i - p_i)^2
`static double` ```euclideanDistance(float[] p, float[] q)```
This returns the distance of two vectors sum(i=1,n) (q_i - p_i)^2
`static double` `factorial(double n)`
This will return the factorial of the given number n.
`static double[]` ```fromString(String data, String separator)```
This will take a given string and separator and convert it to an equivalent double array.
`static double[]` `generateUniform(int l)`
This will generate a series of uniformally distributed numbers between l times
`static boolean` ```gr(double a, double b)```
Tests if a is greater than b.
`static double` ```hypotenuse(double a, double b)```
sqrt(a^2 + b^2) without under/overflow.
`static double` ```idf(double totalDocs, double numTimesWordAppearedInADocument)```
Inverse document frequency: the total docs divided by the number of times the word appeared in a document
`static double` `information(double[] probabilities)`
This returns the entropy for a given vector of probabilities.
`static int` ```kroneckerDelta(double i, double j)```
This returns the kronecker delta of two doubles.
`static double` `log2(double a)`
Returns the logarithm of a for base 2.
`static double[]` `logs2probs(double[] a)`
Converts an array containing the natural logarithms of probabilities stored in a vector back into probabilities.
`static double` ```manhattanDistance(double[] p, double[] q)```
This will calculate the Manhattan distance between two sets of points.
`static double` `max(double[] doubles)`
`static int` `maxIndex(double[] doubles)`
Returns index of maximum element in a given array of doubles.
`static double` `mean(double[] vector)`
Computes the mean for an array of doubles.
`static double[]` ```mergeCoords(double[] x, double[] y)```
This will merge the coordinates of the given coordinate system.
`static List<Double>` ```mergeCoords(List<Double> x, List<Double> y)```
This will merge the coordinates of the given coordinate system.
`static double` `min(double[] doubles)`
`static long` `nextPowOf2(long v)`
See: https://stackoverflow.com/questions/466204/rounding-off-to-nearest-power-of-2
`static void` ```normalize(double[] doubles, double sum)```
Normalizes the doubles in the array using the given value.
`static double` ```normalize(double val, double min, double max)```
Normalize a value (val - min) / (max - min)
`static double[]` `normalizeToOne(double[] doubles)`
`static double` ```permutation(double n, double r)```
This returns the permutation of n choose r.
`static int` ```probRound(double value, Random rand)```
Rounds a double to the next nearest integer value in a probabilistic fashion (e.g. 0.8 has a 20% chance of being rounded down to 0 and a 80% chance of being rounded up to 1).
`static double` `probToLogOdds(double prob)`
Returns the log-odds for a given probability.
`static double` ```randomDoubleBetween(double begin, double end)```
`static float` ```randomFloatBetween(float begin, float end)```
`static int` ```randomNumberBetween(double begin, double end)```
Generates a random integer between the specified numbers
`static int` ```randomNumberBetween(double begin, double end, Random rng)```
Generates a random integer between the specified numbers
`static int` ```randomNumberBetween(double begin, double end, org.apache.commons.math3.random.RandomGenerator rng)```
Generates a random integer between the specified numbers
`static double` ```rootMeansSquaredError(double[] real, double[] predicted)```
This returns the root mean squared error of two data sets
`static int` `round(double value)`
Rounds a double to the next nearest integer value.
`static double` ```roundDouble(double value, int afterDecimalPoint)```
Rounds a double to the given number of decimal places.
`static float` ```roundFloat(float value, int afterDecimalPoint)```
Rounds a double to the given number of decimal places.
`static double[]` ```sampleDoublesInInterval(double[][] doubles, int l)```
`static void` ```shuffleArray(int[] array, long rngSeed)```
`static void` ```shuffleArray(int[] array, Random rng)```
`static double` `sigmoid(double x)`
1 / 1 + exp(-x)
`double` ```slope(double x1, double x2, double y1, double y2)```
This returns the slope of the given points.
`static boolean` ```sm(double a, double b)```
Tests if a is smaller than b.
`static double` ```squaredLoss(double[] x, double[] y, double w_0, double w_1)```
This will return the squared loss of the given points
`static double` ```ssError(double[] predictedValues, double[] targetAttribute)```
How much of the variance is NOT explained by the regression
`static double` ```ssReg(double[] residuals, double[] targetAttribute)```
How much of the variance is explained by the regression
`static double` ```ssTotal(double[] residuals, double[] targetAttribute)```
Total variance in target attribute
`static double` `stringSimilarity(String... strings)`
Calculate string similarity with tfidf weights relative to each character frequency and how many times a character appears in a given string
`static double` `sum(double[] nums)`
This returns the sum of the given array.
`static double` ```sumOfMeanDifferences(double[] vector, double[] vector2)```
Used for calculating top part of simple regression for beta 1
`static double` `sumOfMeanDifferencesOnePoint(double[] vector)`
Used for calculating top part of simple regression for beta 1
`static double` `sumOfProducts(double[]... nums)`
This returns the sum of products for the given numbers.
`static double` `sumOfSquares(double[] vector)`
This returns the sum of squares for the given vector.
`static double` ```tf(int count, int documentLength)```
Term frequency: 1+ log10(count)
`static double` ```tfidf(double tf, double idf)```
Return td * idf
`static double` `times(double[] nums)`
This returns the product of all numbers in the given array.
`static int` `toDecimal(String binary)`
This will convert the given binary string to a decimal based integer
`static double` ```uniform(Random rng, double min, double max)```
Generate a uniform random number from the given rng
`static double` `variance(double[] vector)`
`static double` `vectorLength(double[] vector)`
Returns the vector length (sqrt(sum(x_i))
`static double` ```w_0(double[] x, double[] y, int n)```
`static double` ```w_1(double[] x, double[] y, int n)```
`static double[]` `weightsFor(double[] vector)`
This returns the minimized loss values for a given vector.
`static double[]` `weightsFor(List<Double> vector)`
This returns the minimized loss values for a given vector.
`static double[]` `xVals(double[] vector)`
This returns the x values of the given vector.
`static double[]` `yVals(double[] vector)`
This returns the odd indexed values for the given vector
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### log2

`public static double log2`
The natural logarithm of 2.
• #### SMALL

`public static double SMALL`
The small deviation allowed in double comparisons.
• ### Constructor Detail

• #### MathUtils

`public MathUtils()`
• ### Method Detail

• #### normalize

```public static double normalize(double val,
double min,
double max)```
Normalize a value (val - min) / (max - min)
Parameters:
`val` - value to normalize
`max` - max value
`min` - min value
Returns:
the normalized value
• #### clamp

```public static int clamp(int value,
int min,
int max)```
Clamps the value to a discrete value
Parameters:
`value` - the value to clamp
`min` - min for the probability distribution
`max` - max for the probability distribution
Returns:
the discrete value
• #### discretize

```public static int discretize(double value,
double min,
double max,
int binCount)```
Discretize the given value
Parameters:
`value` - the value to discretize
`min` - the min of the distribution
`max` - the max of the distribution
`binCount` - the number of bins
Returns:
the discretized value
• #### nextPowOf2

`public static long nextPowOf2(long v)`
See: https://stackoverflow.com/questions/466204/rounding-off-to-nearest-power-of-2
Parameters:
`v` - the number to getFromOrigin the next power of 2 for
Returns:
the next power of 2 for the passed in value
• #### binomial

```public static int binomial(org.apache.commons.math3.random.RandomGenerator rng,
int n,
double p)```
Generates a binomial distributed number using the given rng
Parameters:
`rng` -
`n` -
`p` -
Returns:
• #### uniform

```public static double uniform(Random rng,
double min,
double max)```
Generate a uniform random number from the given rng
Parameters:
`rng` - the rng to use
`min` - the min num
`max` - the max num
Returns:
a number uniformly distributed between min and max
• #### correlation

```public static double correlation(double[] residuals,
double[] targetAttribute)```
Returns the correlation coefficient of two double vectors.
Parameters:
`residuals` - residuals
`targetAttribute` - target attribute vector
Returns:
the correlation coefficient or r
• #### sigmoid

`public static double sigmoid(double x)`
1 / 1 + exp(-x)
Parameters:
`x` -
Returns:
• #### ssReg

```public static double ssReg(double[] residuals,
double[] targetAttribute)```
How much of the variance is explained by the regression
Parameters:
`residuals` - error
`targetAttribute` - data for target attribute
Returns:
the sum squares of regression
• #### ssError

```public static double ssError(double[] predictedValues,
double[] targetAttribute)```
How much of the variance is NOT explained by the regression
Parameters:
`predictedValues` - predicted values
`targetAttribute` - data for target attribute
Returns:
the sum squares of regression
• #### stringSimilarity

`public static double stringSimilarity(String... strings)`
Calculate string similarity with tfidf weights relative to each character frequency and how many times a character appears in a given string
Parameters:
`strings` - the strings to calculate similarity for
Returns:
the cosine similarity between the strings
• #### vectorLength

`public static double vectorLength(double[] vector)`
Returns the vector length (sqrt(sum(x_i))
Parameters:
`vector` - the vector to return the vector length for
Returns:
the vector length of the passed in array
• #### idf

```public static double idf(double totalDocs,
Inverse document frequency: the total docs divided by the number of times the word appeared in a document
Parameters:
`totalDocs` - the total documents for the data applyTransformToDestination
`numTimesWordAppearedInADocument` - the number of times the word occurred in a document
Returns:
• #### tf

```public static double tf(int count,
int documentLength)```
Term frequency: 1+ log10(count)
Parameters:
`count` - the count of a word or character in a given string or document
Returns:
1+ log(10) count
• #### tfidf

```public static double tfidf(double tf,
double idf)```
Return td * idf
Parameters:
`tf` - the term frequency (assumed calculated)
`idf` - inverse document frequency (assumed calculated)
Returns:
td * idf
• #### ssTotal

```public static double ssTotal(double[] residuals,
double[] targetAttribute)```
Total variance in target attribute
Parameters:
`residuals` - error
`targetAttribute` - data for target attribute
Returns:
Total variance in target attribute
• #### sum

`public static double sum(double[] nums)`
This returns the sum of the given array.
Parameters:
`nums` - the array of numbers to sum
Returns:
the sum of the given array
• #### mergeCoords

```public static double[] mergeCoords(double[] x,
double[] y)```
This will merge the coordinates of the given coordinate system.
Parameters:
`x` - the x coordinates
`y` - the y coordinates
Returns:
a vector such that each (x,y) pair is at ret[i],ret[i+1]
• #### mergeCoords

```public static List<Double> mergeCoords(List<Double> x,
List<Double> y)```
This will merge the coordinates of the given coordinate system.
Parameters:
`x` - the x coordinates
`y` - the y coordinates
Returns:
a vector such that each (x,y) pair is at ret[i],ret[i+1]
• #### weightsFor

`public static double[] weightsFor(List<Double> vector)`
This returns the minimized loss values for a given vector. It is assumed that the x, y pairs are at vector[i], vector[i+1]
Parameters:
`vector` - the vector of numbers to getFromOrigin the weights for
Returns:
a double array with w_0 and w_1 are the associated indices.
• #### squaredLoss

```public static double squaredLoss(double[] x,
double[] y,
double w_0,
double w_1)```
This will return the squared loss of the given points
Parameters:
`x` - the x coordinates to use
`y` - the y coordinates to use
`w_0` - the first weight
`w_1` - the second weight
Returns:
the squared loss of the given points
• #### w_1

```public static double w_1(double[] x,
double[] y,
int n)```
• #### w_0

```public static double w_0(double[] x,
double[] y,
int n)```
• #### weightsFor

`public static double[] weightsFor(double[] vector)`
This returns the minimized loss values for a given vector. It is assumed that the x, y pairs are at vector[i], vector[i+1]
Parameters:
`vector` - the vector of numbers to getFromOrigin the weights for
Returns:
a double array with w_0 and w_1 are the associated indices.
• #### errorFor

```public static double errorFor(double actual,
double prediction)```
• #### sumOfMeanDifferences

```public static double sumOfMeanDifferences(double[] vector,
double[] vector2)```
Used for calculating top part of simple regression for beta 1
Parameters:
`vector` - the x coordinates
`vector2` - the y coordinates
Returns:
the sum of mean differences for the input vectors
• #### sumOfMeanDifferencesOnePoint

`public static double sumOfMeanDifferencesOnePoint(double[] vector)`
Used for calculating top part of simple regression for beta 1
Parameters:
`vector` - the x coordinates
Returns:
the sum of mean differences for the input vectors
• #### variance

`public static double variance(double[] vector)`
• #### times

`public static double times(double[] nums)`
This returns the product of all numbers in the given array.
Parameters:
`nums` - the numbers to multiply over
Returns:
the product of all numbers in the array, or 0 if the length is or nums i null
• #### sumOfProducts

`public static double sumOfProducts(double[]... nums)`
This returns the sum of products for the given numbers.
Parameters:
`nums` - the sum of products for the give numbers
Returns:
the sum of products for the given numbers
• #### coordSplit

`public static List<double[]> coordSplit(double[] vector)`
This returns the coordinate split in a list of coordinates such that the values for ret are the x values and ret are the y values
Parameters:
`vector` - the vector to split with x and y values/
Returns:
a coordinate split for the given vector of values. if null, is passed in null is returned
• #### coordSplit

`public static List<double[]> coordSplit(List<Double> vector)`
This returns the coordinate split in a list of coordinates such that the values for ret are the x values and ret are the y values
Parameters:
`vector` - the vector to split with x and y values Note that the list will be more stable due to the size operator. The array version will have extraneous values if not monitored properly.
Returns:
a coordinate split for the given vector of values. if null, is passed in null is returned
• #### xVals

`public static double[] xVals(double[] vector)`
This returns the x values of the given vector. These are assumed to be the even values of the vector.
Parameters:
`vector` - the vector to getFromOrigin the values for
Returns:
the x values of the given vector
• #### yVals

`public static double[] yVals(double[] vector)`
This returns the odd indexed values for the given vector
Parameters:
`vector` - the odd indexed values of rht egiven vector
Returns:
the y values of the given vector
• #### sumOfSquares

`public static double sumOfSquares(double[] vector)`
This returns the sum of squares for the given vector.
Parameters:
`vector` - the vector to obtain the sum of squares for
Returns:
the sum of squares for this vector
• #### determinationCoefficient

```public static double determinationCoefficient(double[] y1,
double[] y2,
int n)```
This returns the determination coefficient of two vectors given a length
Parameters:
`y1` - the first vector
`y2` - the second vector
`n` - the length of both vectors
Returns:
the determination coefficient or r^2
• #### log2

`public static double log2(double a)`
Returns the logarithm of a for base 2.
Parameters:
`a` - a double
Returns:
the logarithm for base 2
• #### slope

```public double slope(double x1,
double x2,
double y1,
double y2)```
This returns the slope of the given points.
Parameters:
`x1` - the first x to use
`x2` - the end x to use
`y1` - the begin y to use
`y2` - the end y to use
Returns:
the slope of the given points
• #### rootMeansSquaredError

```public static double rootMeansSquaredError(double[] real,
double[] predicted)```
This returns the root mean squared error of two data sets
Parameters:
`real` - the real values
`predicted` - the predicted values
Returns:
the root means squared error for two data sets
• #### entropy

`public static double entropy(double[] vector)`
This returns the entropy (information gain, or uncertainty of a random variable).
Parameters:
`vector` - the vector of values to getFromOrigin the entropy for
Returns:
the entropy of the given vector
• #### kroneckerDelta

```public static int kroneckerDelta(double i,
double j)```
This returns the kronecker delta of two doubles.
Parameters:
`i` - the first number to compare
`j` - the second number to compare
Returns:
1 if they are equal, 0 otherwise

```public static double adjustedrSquared(double rSquared,
int numRegressors,
int numDataPoints)```
This calculates the adjusted r^2 including degrees of freedom. Also known as calculating "strength" of a regression
Parameters:
`rSquared` - the r squared value to calculate
`numRegressors` - number of variables
`numDataPoints` - size of the data applyTransformToDestination
Returns:
an adjusted r^2 for degrees of freedom
• #### normalizeToOne

`public static double[] normalizeToOne(double[] doubles)`
• #### min

`public static double min(double[] doubles)`
• #### max

`public static double max(double[] doubles)`
• #### normalize

```public static void normalize(double[] doubles,
double sum)```
Normalizes the doubles in the array using the given value.
Parameters:
`doubles` - the array of double
`sum` - the value by which the doubles are to be normalized
Throws:
`IllegalArgumentException` - if sum is zero or NaN
• #### logs2probs

`public static double[] logs2probs(double[] a)`
Converts an array containing the natural logarithms of probabilities stored in a vector back into probabilities. The probabilities are assumed to sum to one.
Parameters:
`a` - an array holding the natural logarithms of the probabilities
Returns:
the converted array
• #### information

`public static double information(double[] probabilities)`
This returns the entropy for a given vector of probabilities.
Parameters:
`probabilities` - the probabilities to getFromOrigin the entropy for
Returns:
the entropy of the given probabilities.
• #### maxIndex

`public static int maxIndex(double[] doubles)`
Returns index of maximum element in a given array of doubles. First maximum is returned.
Parameters:
`doubles` - the array of doubles
Returns:
the index of the maximum element
• #### factorial

`public static double factorial(double n)`
This will return the factorial of the given number n.
Parameters:
`n` - the number to getFromOrigin the factorial for
Returns:
the factorial for this number
• #### probToLogOdds

`public static double probToLogOdds(double prob)`
Returns the log-odds for a given probability.
Parameters:
`prob` - the probability
Returns:
the log-odds after the probability has been mapped to [Utils.SMALL, 1-Utils.SMALL]
• #### round

`public static int round(double value)`
Rounds a double to the next nearest integer value. The JDK version of it doesn't work properly.
Parameters:
`value` - the double value
Returns:
the resulting integer value
• #### permutation

```public static double permutation(double n,
double r)```
This returns the permutation of n choose r.
Parameters:
`n` - the n to choose
`r` - the number of elements to choose
Returns:
the permutation of these numbers
• #### combination

```public static double combination(double n,
double r)```
This returns the combination of n choose r
Parameters:
`n` - the number of elements overall
`r` - the number of elements to choose
Returns:
the amount of possible combinations for this applyTransformToDestination of elements
• #### hypotenuse

```public static double hypotenuse(double a,
double b)```
sqrt(a^2 + b^2) without under/overflow.
• #### probRound

```public static int probRound(double value,
Random rand)```
Rounds a double to the next nearest integer value in a probabilistic fashion (e.g. 0.8 has a 20% chance of being rounded down to 0 and a 80% chance of being rounded up to 1). In the limit, the average of the rounded numbers generated by this procedure should converge to the original double.
Parameters:
`value` - the double value
`rand` - the random number generator
Returns:
the resulting integer value
• #### roundDouble

```public static double roundDouble(double value,
int afterDecimalPoint)```
Rounds a double to the given number of decimal places.
Parameters:
`value` - the double value
`afterDecimalPoint` - the number of digits after the decimal point
Returns:
the double rounded to the given precision
• #### roundFloat

```public static float roundFloat(float value,
int afterDecimalPoint)```
Rounds a double to the given number of decimal places.
Parameters:
`value` - the double value
`afterDecimalPoint` - the number of digits after the decimal point
Returns:
the double rounded to the given precision
• #### bernoullis

```public static double bernoullis(double n,
double k,
double successProb)```
This will return the bernoulli trial for the given event. A bernoulli trial is a mechanism for detecting the probability of a given event occurring k times in n independent trials
Parameters:
`n` - the number of trials
`k` - the number of times the target event occurs
`successProb` - the probability of the event happening
Returns:
the probability of the given event occurring k times.
• #### sm

```public static boolean sm(double a,
double b)```
Tests if a is smaller than b.
Parameters:
`a` - a double
`b` - a double
• #### gr

```public static boolean gr(double a,
double b)```
Tests if a is greater than b.
Parameters:
`a` - a double
`b` - a double
• #### fromString

```public static double[] fromString(String data,
String separator)```
This will take a given string and separator and convert it to an equivalent double array.
Parameters:
`data` - the data to separate
`separator` - the separator to use
Returns:
the new double array based on the given data
• #### mean

`public static double mean(double[] vector)`
Computes the mean for an array of doubles.
Parameters:
`vector` - the array
Returns:
the mean
• #### choleskyFromMatrix

```public org.apache.commons.math3.linear.CholeskyDecomposition choleskyFromMatrix(org.apache.commons.math3.linear.RealMatrix m)
throws Exception```
This will return the cholesky decomposition of the given matrix
Parameters:
`m` - the matrix to convert
Returns:
the cholesky decomposition of the given matrix. See: http://en.wikipedia.org/wiki/Cholesky_decomposition
Throws:
`org.apache.commons.math3.linear.NonSquareMatrixException`
`Exception`
• #### toDecimal

`public static int toDecimal(String binary)`
This will convert the given binary string to a decimal based integer
Parameters:
`binary` - the binary string to convert
Returns:
an equivalent base 10 number
• #### distanceFinderZValue

`public static int distanceFinderZValue(double[] vector)`
This will translate a vector in to an equivalent integer
Parameters:
`vector` - the vector to translate
Returns:
a z value such that the value is the interleaved lsd to msd for each double in the vector
• #### euclideanDistance

```public static double euclideanDistance(double[] p,
double[] q)```
This returns the distance of two vectors sum(i=1,n) (q_i - p_i)^2
Parameters:
`p` - the first vector
`q` - the second vector
Returns:
the distance between two vectors
• #### euclideanDistance

```public static double euclideanDistance(float[] p,
float[] q)```
This returns the distance of two vectors sum(i=1,n) (q_i - p_i)^2
Parameters:
`p` - the first vector
`q` - the second vector
Returns:
the distance between two vectors
• #### generateUniform

`public static double[] generateUniform(int l)`
This will generate a series of uniformally distributed numbers between l times
Parameters:
`l` - the number of numbers to generate
Returns:
l uniformally generated numbers
• #### manhattanDistance

```public static double manhattanDistance(double[] p,
double[] q)```
This will calculate the Manhattan distance between two sets of points. The Manhattan distance is equivalent to: 1_sum_n |p_i - q_i|
Parameters:
`p` - the first point vector
`q` - the second point vector
Returns:
the Manhattan distance between two object
• #### sampleDoublesInInterval

```public static double[] sampleDoublesInInterval(double[][] doubles,
int l)```
• #### randomNumberBetween

```public static int randomNumberBetween(double begin,
double end)```
Generates a random integer between the specified numbers
Parameters:
`begin` - the begin of the interval
`end` - the end of the interval
Returns:
an int between begin and end
• #### randomNumberBetween

```public static int randomNumberBetween(double begin,
double end,
org.apache.commons.math3.random.RandomGenerator rng)```
Generates a random integer between the specified numbers
Parameters:
`begin` - the begin of the interval
`end` - the end of the interval
Returns:
an int between begin and end
• #### randomNumberBetween

```public static int randomNumberBetween(double begin,
double end,
Random rng)```
Generates a random integer between the specified numbers
Parameters:
`begin` - the begin of the interval
`end` - the end of the interval
Returns:
an int between begin and end
• #### randomFloatBetween

```public static float randomFloatBetween(float begin,
float end)```
Parameters:
`begin` -
`end` -
Returns:
• #### randomDoubleBetween

```public static double randomDoubleBetween(double begin,
double end)```
• #### shuffleArray

```public static void shuffleArray(int[] array,
long rngSeed)```
• #### shuffleArray

```public static void shuffleArray(int[] array,
Random rng)```