SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
LognormalGen.java
1/*
2 * Class: LognormalGen
3 * Description: random variate generator for the lognormal 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
48public class LognormalGen extends RandomVariateGen {
49 private double mu;
50 private double sigma = -1.0;
51
57 public LognormalGen(RandomStream s, double mu, double sigma) {
58 this(s, new LognormalDist(mu, sigma));
59 setParams(mu, sigma);
60 }
61
68 this(s, 0.0, 1.0);
69 }
70
76 super(s, dist);
77 if (dist != null)
78 setParams(dist.getMu(), dist.getSigma());
79 }
80
86 public static double nextDouble(RandomStream s, double mu, double sigma) {
87 return LognormalDist.inverseF(mu, sigma, s.nextDouble());
88 }
89
93 public double getMu() {
94 return mu;
95 }
96
100 public double getSigma() {
101 return sigma;
102 }
103
107 protected void setParams(double mu, double sigma) {
108 if (sigma <= 0)
109 throw new IllegalArgumentException("sigma <= 0");
110 this.mu = mu;
111 this.sigma = sigma;
112 }
113}
Extends the class ContinuousDistribution for the lognormal distribution tjoh95a .
double inverseF(double u)
Returns the inverse distribution function .
void setParams(double mu, double sigma)
Sets the parameters and of this object.
static double nextDouble(RandomStream s, double mu, double sigma)
Generates a new variate from the lognormal distribution with parameters &#160;mu and &#160;sigma,...
LognormalGen(RandomStream s)
Creates a lognormal random variate generator with parameters.
double getSigma()
Returns the parameter of this object.
LognormalGen(RandomStream s, LognormalDist dist)
Create a random variate generator for the lognormal distribution dist and stream s.
double getMu()
Returns the parameter of this object.
LognormalGen(RandomStream s, double mu, double sigma)
Creates a lognormal random variate generator with parameters.
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,...