SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
WeibullGen.java
1/*
2 * Class: WeibullGen
3 * Description: Weibull random number generator
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
46public class WeibullGen extends RandomVariateGen {
47 private double alpha = -1.0;
48 private double lambda = -1.0;
49 private double delta = -1.0;
50
57 public WeibullGen(RandomStream s, double alpha, double lambda, double delta) {
58 super(s, new WeibullDist(alpha, lambda, delta));
59 setParams(alpha, lambda, delta);
60 }
61
68 public WeibullGen(RandomStream s, double alpha) {
69 this(s, alpha, 1.0, 0.0);
70 }
71
76 super(s, dist);
77 if (dist != null)
78 setParams(dist.getAlpha(), dist.getLambda(), dist.getDelta());
79 }
80
88 public static double nextDouble(RandomStream s, double alpha, double lambda, double delta) {
89 return WeibullDist.inverseF(alpha, lambda, delta, s.nextDouble());
90 }
91
95 public double getAlpha() {
96 return alpha;
97 }
98
102 public double getLambda() {
103 return lambda;
104 }
105
109 public double getDelta() {
110 return delta;
111 }
112
117 public void setParams(double alpha, double lambda, double delta) {
118 if (alpha <= 0.0)
119 throw new IllegalArgumentException("alpha <= 0");
120 if (lambda <= 0.0)
121 throw new IllegalArgumentException("lambda <= 0");
122 this.alpha = alpha;
123 this.lambda = lambda;
124 this.delta = delta;
125 }
126}
This class extends the class ContinuousDistribution for the Weibull distribution tjoh95a  (page 628) ...
double inverseF(double u)
Returns the inverse distribution function .
static double nextDouble(RandomStream s, double alpha, double lambda, double delta)
Uses inversion to generate a new variate from the Weibull distribution with parameters &#160;alpha,...
double getLambda()
Returns the parameter .
WeibullGen(RandomStream s, WeibullDist dist)
Creates a new generator for the Weibull distribution dist and stream s.
double getAlpha()
Returns the parameter .
WeibullGen(RandomStream s, double alpha)
Creates a Weibull random variate generator with parameters.
void setParams(double alpha, double lambda, double delta)
Sets the parameters , and for this object.
WeibullGen(RandomStream s, double alpha, double lambda, double delta)
Creates a Weibull random variate generator with parameters.
double getDelta()
Returns the parameter .
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,...