public class LinearDistributionNearbyRandom extends Object implements NearbyRandom
P(x) = 2/m - 2x/m².
Cumulative probability: F(x) = x(2m - x)/m².
Inverse cumulative probability: F(p) = m(1 - (1 - p)^(1/2)).
| Modifier and Type | Field and Description |
|---|---|
protected int |
sizeMaximum |
| Constructor and Description |
|---|
LinearDistributionNearbyRandom(int sizeMaximum) |
| Modifier and Type | Method and Description |
|---|---|
int |
getOverallSizeMaximum()
Used to limit the RAM memory size of the nearby distance matrix.
|
int |
nextInt(Random random,
int nearbySize) |
public LinearDistributionNearbyRandom(int sizeMaximum)
public int nextInt(Random random, int nearbySize)
nextInt in interface NearbyRandomrandom - never nullnearbySize - never negative. The number of available values to select from.
Normally this is the size of the value range for a non-chained variable
and the size of the value range (= size of the entity list) minus 1 for a chained variable.0 <= x < nearbySizepublic int getOverallSizeMaximum()
NearbyRandomgetOverallSizeMaximum in interface NearbyRandomNearbyRandom.nextInt(Random, int) can potentially ever returnCopyright © 2006–2017 JBoss by Red Hat. All rights reserved.