public final class BiasedNumbers extends Object
Constructor and Description |
---|
BiasedNumbers() |
Modifier and Type | Method and Description |
---|---|
static double |
fuzzDown(Random r,
double v,
double min)
Fuzzify the input value by decreasing it by a few ulps, but never past min.
|
static float |
fuzzDown(Random r,
float v,
float min)
Fuzzify the input value by decreasing it by a few ulps, but never past min.
|
static double |
fuzzUp(Random r,
double v,
double max)
Fuzzify the input value by increasing it by a few ulps, but never past max.
|
static float |
fuzzUp(Random r,
float v,
float max)
Fuzzify the input value by increasing it by a few ulps, but never past max.
|
static double |
randomDoubleBetween(Random r,
double min,
double max)
A random double between
min (inclusive) and max
(inclusive). |
static float |
randomFloatBetween(Random r,
float min,
float max)
A random float between
min (inclusive) and max
(inclusive). |
public static double randomDoubleBetween(Random r, double min, double max)
min
(inclusive) and max
(inclusive). If you wish to have an exclusive range,
use Math.nextAfter(double, double)
to adjust the range.
The code was inspired by GeoTestUtil from Apache Lucene.min
- Left range boundary, inclusive. May be Double.NEGATIVE_INFINITY
, but not NaN.max
- Right range boundary, inclusive. May be Double.POSITIVE_INFINITY
, but not NaN.public static double fuzzDown(Random r, double v, double min)
public static double fuzzUp(Random r, double v, double max)
public static float randomFloatBetween(Random r, float min, float max)
min
(inclusive) and max
(inclusive). If you wish to have an exclusive range,
use Math.nextAfter(float, double)
to adjust the range.
The code was inspired by GeoTestUtil from Apache Lucene.min
- Left range boundary, inclusive. May be Float.NEGATIVE_INFINITY
, but not NaN.max
- Right range boundary, inclusive. May be Float.POSITIVE_INFINITY
, but not NaN.public static float fuzzDown(Random r, float v, float min)
public static float fuzzUp(Random r, float v, float max)
Copyright © 2011–2018 Carrot Search s.c.. All rights reserved.