SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
ExponentialGen.java
1/*
2 * Class: ExponentialGen
3 * Description: random variate generators for the exponential distribution
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.randvar;
26
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29
42public class ExponentialGen extends RandomVariateGen {
43 protected double lambda;
44
50 public ExponentialGen(RandomStream s, double lambda) {
51 super(s, new ExponentialDist(lambda));
52 setParams(lambda);
53 }
54
60 super(s, dist);
61 if (dist != null)
62 setParams(dist.getLambda());
63 }
64
70 public static double nextDouble(RandomStream s, double lambda) {
71 return ExponentialDist.inverseF(lambda, s.nextDouble());
72 }
73
77 public double getLambda() {
78 return lambda;
79 }
80
84 protected void setParams(double lam) {
85 if (lam <= 0.0)
86 throw new IllegalArgumentException("lambda <= 0");
87 this.lambda = lam;
88 }
89}
Extends the class ContinuousDistribution for the exponential distribution tjoh95a  (page 494) with me...
double inverseF(double u)
Returns the inverse distribution function .
double getLambda()
Returns the associated with this object.
ExponentialGen(RandomStream s, double lambda)
Creates an exponential random variate generator with parameter.
void setParams(double lam)
Sets the parameter lam of this object.
static double nextDouble(RandomStream s, double lambda)
Uses inversion to generate a new exponential variate with parameter.
ExponentialGen(RandomStream s, ExponentialDist dist)
Creates a new generator for the exponential distribution dist and stream s.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...