Java Utililty Methods Random Double

List of utility methods to do Random Double

Description

The list of methods to do Random Double are organized into topic(s).

Method

doublegenerateRandomDoubleInRange(double min, double max)
generate Random Double In Range
return min + (max - min) * Math.random();
doublegenerateRandomLongitude()
generate Random Longitude
return MIN_LONG + (double) (Math.random() * ((MAX_LONG - MIN_LONG) + 1));
doublegetDouble()
Gets a random double.
return RANDOM.nextDouble();
doublegetDouble()
get Double
return random.nextDouble();
doublegetDoubleInRange(double minValue, double maxValue)
It returns a double/Double value between min and max value (included).
if (minValue == maxValue) {
    return minValue;
double retValue;
double margin = (maxValue - minValue + 0.1);
do {
    retValue = minValue + RANDOM.nextDouble() * margin;
} while (retValue > maxValue);
...
doublegetDoubleSpecial()
get Double Special
int i = rng.nextInt();
long j = rng.nextLong();
double f = Double.longBitsToDouble(j);
if (f != f)
    f = 0; 
if ((i & 0x10) != 0)
    return f;
return dspecial[((int) j & 0x7fffffff) % dspecial.length] * ((i & 0x20) == 0 ? 1 : -1) + ((i & 0x03) - 1);
...
doublegetRandomDouble()
Generates next random double
return getRandomDouble(0, 0);
doublegetRandomDouble(double min, double max)
get Random Double
if (min > max)
    throw new IllegalArgumentException("min > max");
return (random.nextDouble() * (max - min)) + min;
doublerand(double seed)
Return a random number, which is also the next seed.
double t = A * seed + 1;
seed = t - (M * Math.floor(t / M));
return seed;
doublerandDouble()
rand 0-1 double
return (double) randInt() / (double) Integer.MAX_VALUE;