SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
PowerGen.java
1/*
2 * Class: PowerGen
3 * Description: random variate generators for the power 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 PowerGen extends RandomVariateGen {
43 private double a;
44 private double b;
45 private double c;
46
51 public PowerGen(RandomStream s, double a, double b, double c) {
52 super(s, new PowerDist(a, b, c));
53 setParams(a, b, c);
54 }
55
61 public PowerGen(RandomStream s, double c) {
62 super(s, new PowerDist(0.0, 1.0, c));
63 setParams(0.0, 1.0, c);
64 }
65
70 super(s, dist);
71 if (dist != null)
72 setParams(dist.getA(), dist.getB(), dist.getC());
73 }
74
81 public static double nextDouble(RandomStream s, double a, double b, double c) {
82 return PowerDist.inverseF(a, b, c, s.nextDouble());
83 }
84
88 public double getA() {
89 return a;
90 }
91
95 public double getB() {
96 return b;
97 }
98
102 public double getC() {
103 return c;
104 }
105
109 public void setParams(double a, double b, double c) {
110 this.a = a;
111 this.b = b;
112 this.c = c;
113 }
114}
Extends the class ContinuousDistribution for the power distribution teva00a  (page 161) with shape pa...
double inverseF(double u)
Returns the inverse distribution function .
double getB()
Returns the parameter .
Definition PowerGen.java:95
PowerGen(RandomStream s, double a, double b, double c)
Creates a Power random variate generator with parameters a, b and c, using stream s.
Definition PowerGen.java:51
void setParams(double a, double b, double c)
Sets the parameters , and for this object.
double getC()
Returns the parameter .
PowerGen(RandomStream s, double c)
Creates a Power random variate generator with parameters ,.
Definition PowerGen.java:61
PowerGen(RandomStream s, PowerDist dist)
Creates a new generator for the power distribution dist and stream s.
Definition PowerGen.java:69
double getA()
Returns the parameter .
Definition PowerGen.java:88
static double nextDouble(RandomStream s, double a, double b, double c)
Uses inversion to generate a new variate from the power distribution with parameters  a,...
Definition PowerGen.java:81
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,...