Package jasima.core.random.discrete
Class IntEmpirical
- java.lang.Object
-
- jasima.core.random.continuous.DblSequence
-
- jasima.core.random.discrete.IntSequence
-
- jasima.core.random.discrete.IntEmpirical
-
- All Implemented Interfaces:
Serializable,Cloneable
public class IntEmpirical extends IntSequence
Returns an integer in the range [0,n]. The probability of each value is determined by the probabilities passed tosetProbabilities(double[]), and can be arbitrary positive numbers as long as they sum up to 1.0.- Author:
- Torsten Hildebrandt
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class jasima.core.random.continuous.DblSequence
rndGen
-
-
Constructor Summary
Constructors Constructor Description IntEmpirical()IntEmpirical(double[] probs)IntEmpirical(double[] probs, int[] values)IntEmpirical(String name, double[] probs)IntEmpirical(String name, double[] probs, int[] values)IntEmpirical(Random rnd, double[] probs)IntEmpirical(Random rnd, double[] probs, int[] values)IntEmpirical(Random rnd, String name, double[] probs, int[] values)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntEmpiricalclone()Clones the current number stream.doublegetNumericalMean()Returns the arithmetic mean of the values returned byDblSequence.nextDbl().double[]getProbabilities()Pair<Double,Double>getValueRange()This method computes the minimum and maximum support values (range of possible values) of this stream.int[]getValues()intnextInt()voidsetProbabilities(double[] probs)voidsetProbabilities(double[] probs, int[] values)voidsetValues(int[] vs)StringtoString()-
Methods inherited from class jasima.core.random.discrete.IntSequence
nextDbl
-
Methods inherited from class jasima.core.random.continuous.DblSequence
createStreamDefFromStream, getName, getRndGen, init, max, min, setName, setRndGen
-
-
-
-
Constructor Detail
-
IntEmpirical
public IntEmpirical()
-
IntEmpirical
public IntEmpirical(double[] probs)
-
IntEmpirical
public IntEmpirical(Random rnd, double[] probs)
-
IntEmpirical
public IntEmpirical(String name, double[] probs)
-
IntEmpirical
public IntEmpirical(double[] probs, int[] values)
-
IntEmpirical
public IntEmpirical(Random rnd, double[] probs, int[] values)
-
IntEmpirical
public IntEmpirical(String name, double[] probs, int[] values)
-
-
Method Detail
-
getProbabilities
public double[] getProbabilities()
-
setProbabilities
public void setProbabilities(double[] probs)
-
getValues
public int[] getValues()
-
setValues
public void setValues(int[] vs)
-
nextInt
public int nextInt()
- Specified by:
nextIntin classIntSequence
-
setProbabilities
public void setProbabilities(double[] probs, int[] values)
-
getNumericalMean
public double getNumericalMean()
Description copied from class:DblSequenceReturns the arithmetic mean of the values returned byDblSequence.nextDbl().- Overrides:
getNumericalMeanin classDblSequence
-
clone
public IntEmpirical clone()
Description copied from class:DblSequenceClones the current number stream. This method fails with aCloneNotSupportedExceptionif there is a random number generator associated with this stream.- Overrides:
clonein classIntSequence
-
getValueRange
public Pair<Double,Double> getValueRange()
Description copied from class:DblSequenceThis method computes the minimum and maximum support values (range of possible values) of this stream.- Overrides:
getValueRangein classDblSequence- Returns:
- A
Paircontaining the minimum and maximum support values.
-
-