umontreal.iro.lecuyer.randvar
Class UnuranDiscreteInt
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- umontreal.iro.lecuyer.randvar.RandomVariateGenInt
-
- umontreal.iro.lecuyer.randvar.UnuranDiscreteInt
-
public class UnuranDiscreteInt extends RandomVariateGenInt
This class permits one to create a discrete univariate distribution using UNURAN via its string API.
-
-
Constructor Summary
Constructors Constructor and Description UnuranDiscreteInt(RandomStream s, RandomStream aux, java.lang.String genStr)Constructs a new discrete random number generator using the UNURAN generator specification string genStr, main stream s, and auxiliary stream aux.UnuranDiscreteInt(RandomStream s, java.lang.String genStr)Same asUnuranDiscreteInt(s, s, genStr).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RandomStreamgetAuxStream()Returns the auxiliary random number stream.DiscreteDistributionIntgetDistribution()Returns theDiscreteDistributionIntused by this generator.RandomStreamgetStream()Returns theRandomStreamused by this generator.voidnextArrayOfInt(int[] v, int start, int n)Generates n random numbers from the discrete distribution contained in this object.intnextInt()Generates a random number (an integer) from the discrete distribution contained in this object.-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
nextArrayOfDouble, nextDouble, setStream, toString
-
-
-
-
Constructor Detail
-
UnuranDiscreteInt
public UnuranDiscreteInt(RandomStream s, java.lang.String genStr)
Same asUnuranDiscreteInt(s, s, genStr).
-
UnuranDiscreteInt
public UnuranDiscreteInt(RandomStream s, RandomStream aux, java.lang.String genStr)
Constructs a new discrete random number generator using the UNURAN generator specification string genStr, main stream s, and auxiliary stream aux.
-
-
Method Detail
-
nextInt
public int nextInt()
Description copied from class:RandomVariateGenIntGenerates a random number (an integer) from the discrete distribution contained in this object. By default, this method uses inversion by calling the inverseF method of the distribution object. Alternative generating methods are provided in subclasses.- Overrides:
nextIntin classRandomVariateGenInt- Returns:
- the generated value
-
nextArrayOfInt
public void nextArrayOfInt(int[] v, int start, int n)Description copied from class:RandomVariateGenIntGenerates n random numbers from the discrete distribution contained in this object. The results are stored into the array v, starting from index start. By default, this method callsnextInt()n times, but one can reimplement it in subclasses for better efficiency.- Overrides:
nextArrayOfIntin classRandomVariateGenInt- Parameters:
v- array into which the variates will be storedstart- starting index, in v, of the new variatesn- number of variates being generated
-
getDistribution
public DiscreteDistributionInt getDistribution()
Description copied from class:RandomVariateGenIntReturns theDiscreteDistributionIntused by this generator.- Overrides:
getDistributionin classRandomVariateGenInt- Returns:
- the distribution associated to that object
-
getStream
public RandomStream getStream()
Description copied from class:RandomVariateGenReturns theRandomStreamused by this generator.- Overrides:
getStreamin classRandomVariateGen- Returns:
- the stream associated to this object
-
getAuxStream
public RandomStream getAuxStream()
Returns the auxiliary random number stream.
-
-
DMelt 3.0 © DataMelt by jWork.ORG