Java Utililty Methods Random Double

List of utility methods to do Random Double

  1. HOME
  2. Java
  3. R
  4. Random Double

Description

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

Method

double generateRandomDoubleInRange(double min, double max)
generate Random Double In Range
return min + (max - min) * Math.random();
double generateRandomLongitude()
generate Random Longitude
return MIN_LONG + (double) (Math.random() * ((MAX_LONG - MIN_LONG) + 1));
double getDouble()
Gets a random double.
return RANDOM.nextDouble();
double getDouble()
get Double
return random.nextDouble();
double getDoubleInRange(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);
...
double getDoubleSpecial()
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);
...
double getRandomDouble()
Generates next random double
return getRandomDouble(0, 0);
double getRandomDouble(double min, double max)
get Random Double
if (min > max)
 throw new IllegalArgumentException("min > max");
return (random.nextDouble() * (max - min)) + min;
double rand(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;
double randDouble()
rand 0-1 double
return (double) randInt() / (double) Integer.MAX_VALUE;


AltStyle によって変換されたページ (->オリジナル) /