SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
RayleighGen.java
1/*
2 * Class: RayleighGen
3 * Description: random variate generators for the Rayleigh 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
40public class RayleighGen extends RandomVariateGen {
41 private double a;
42 private double beta;
43
48 public RayleighGen(RandomStream s, double a, double beta) {
49 super(s, new RayleighDist(a, beta));
50 setParams(a, beta);
51 }
52
57 public RayleighGen(RandomStream s, double beta) {
58 this(s, 0.0, beta);
59 }
60
65 super(s, dist);
66 if (dist != null)
67 setParams(dist.getA(), dist.getSigma());
68 }
69
76 public static double nextDouble(RandomStream s, double a, double beta) {
77 return RayleighDist.inverseF(a, beta, s.nextDouble());
78 }
79
83 public double getA() {
84 return a;
85 }
86
90 public double getSigma() {
91 return beta;
92 }
93
99 public void setParams(double a, double beta) {
100 if (beta <= 0.0)
101 throw new IllegalArgumentException("beta <= 0");
102 this.a = a;
103 this.beta = beta;
104 }
105
106}
This class extends the class ContinuousDistribution for the Rayleigh distribution teva00a  with locat...
double inverseF(double u)
Returns the inverse distribution function .
double getA()
Returns the parameter .
static double nextDouble(RandomStream s, double a, double beta)
Uses inversion to generate a new variate from the Rayleigh distribution with parameters &#160;a and &#160;b...
double getSigma()
Returns the parameter .
void setParams(double a, double beta)
Sets the parameters &#160;a and.
RayleighGen(RandomStream s, RayleighDist dist)
Creates a new generator for the Rayleigh distribution dist and stream s.
RayleighGen(RandomStream s, double beta)
Creates a Rayleigh random variate generator with parameters and beta, using stream s.
RayleighGen(RandomStream s, double a, double beta)
Creates a Rayleigh random variate generator with parameters a and beta, using 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,...