Class NormalDistribution
java.lang.Object
org.apache.tinkerpop.gremlin.algorithm.generator.NormalDistribution
- All Implemented Interfaces:
Distribution
Generates values according to a normal distribution with the configured standard deviation.
- Author:
- Matthias Broecheler (me@matthiasb.com)
-
Constructor Summary
ConstructorsConstructorDescriptionNormalDistribution(double stdDeviation) Constructs a NormalDistribution with the given standard deviation. -
Method Summary
Modifier and TypeMethodDescriptioninitialize(int invocations, int expectedTotal) Initializes the distribution such that expectedTotal is equal to the expected sum of generated values after the given number of invocatiosn.intnextConditionalValue(Random random, int otherValue) Returns the next value conditional on another given value.intReturns the next value.toString()
-
Constructor Details
-
NormalDistribution
public NormalDistribution(double stdDeviation) Constructs a NormalDistribution with the given standard deviation. Setting the standard deviation to 0 makes this a constant distribution.- Parameters:
stdDeviation- Simple deviation of the distribution. Must be non-negative.
-
-
Method Details
-
initialize
Description copied from interface:DistributionInitializes the distribution such that expectedTotal is equal to the expected sum of generated values after the given number of invocatiosn. Since most distributions have an element of randomness, these values are the expected values.- Specified by:
initializein interfaceDistribution- Returns:
- A new distribution configured to match the expected total for the number of invocations.
-
nextValue
Description copied from interface:DistributionReturns the next value. If this value is randomly generated, the randomness must be drawn from the provided random generator. DO NOT use your own internal random generator as this makes the generated values non-reproducible and leads to faulty behavior.- Specified by:
nextValuein interfaceDistribution- Parameters:
random- random generator to use for randomness- Returns:
- next value
-
nextConditionalValue
Description copied from interface:DistributionReturns the next value conditional on another given value. This can be used, for instance, to define conditional degree distributions where the in-degree is conditional on the out-degree. If this value is randomly generated, the randomness must be drawn from the provided random generator. DO NOT use your own internal random generator as this makes the generated values non-reproducible and leads to faulty behavior.- Specified by:
nextConditionalValuein interfaceDistribution- Parameters:
random- random generator to use for randomnessotherValue- The prior value- Returns:
- next value
-
toString
-