Package jline.solvers.ldes.handlers
Class Solver_ssj.DiscreteUniformGen
java.lang.Object
umontreal.ssj.randvar.RandomVariateGen
jline.solvers.ldes.handlers.Solver_ssj.DiscreteUniformGen
- Enclosing class:
- Solver_ssj
public static class Solver_ssj.DiscreteUniformGen
extends umontreal.ssj.randvar.RandomVariateGen
Random variate generator for
DiscreteUniform,
the uniform law on the w = max - min + 1 points
min, min+1, ..., max.
The struct carries the law as the moment pair {mean, SCV} rather than as
its bounds, exactly as it carries a Geometric, so the bounds are recovered
here: var = SCV*mean^2 and var = (w^2-1)/12 give the integral
width w = sqrt(12*var+1), and mean = (min+max)/2 then places
it, which is exact and leaves a non-integral lower bound (a lattice shifted
off the integers) where the user put it.
The draw is SSJ's UniformIntDist.inverseF, min + (int)(u*w),
so it costs ONE uniform and the native C++ engine reproduces the same point.
-
Field Summary
Fields inherited from class umontreal.ssj.randvar.RandomVariateGen
dist, stream -
Constructor Summary
ConstructorsConstructorDescriptionDiscreteUniformGen(umontreal.ssj.rng.RandomStream stream, double min, double width) -
Method Summary
Methods inherited from class umontreal.ssj.randvar.RandomVariateGen
getDistribution, getStream, nextArrayOfDouble, nextArrayOfDouble, setStream, toString
-
Constructor Details
-
DiscreteUniformGen
public DiscreteUniformGen(umontreal.ssj.rng.RandomStream stream, double min, double width)
-
-
Method Details
-
nextDouble
public double nextDouble()- Overrides:
nextDoublein classumontreal.ssj.randvar.RandomVariateGen
-