SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
StudentGen.java
1/*
2 * Class: StudentGen
3 * Description: Student-t random variate generators
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
78public class StudentGen extends RandomVariateGen {
79 protected int n = -1;
80
85 public StudentGen(RandomStream s, int n) {
86 super(s, new StudentDist(n));
87 setN(n);
88 }
89
94 super(s, dist);
95 if (dist != null)
96 setN(dist.getN());
97 }
98
104 public static double nextDouble(RandomStream s, int n) {
105 return StudentDist.inverseF(n, s.nextDouble());
106 }
107
111 public int getN() {
112 return n;
113 }
114
115 protected void setN(int nu) {
116 if (nu <= 0)
117 throw new IllegalArgumentException("n <= 0");
118 this.n = nu;
119 }
120}
Extends the class ContinuousDistribution for the Student.
double inverseF(double u)
Returns the inverse distribution function .
StudentGen(RandomStream s, StudentDist dist)
Creates a new generator for the Student distribution dist and stream s.
StudentGen(RandomStream s, int n)
Creates a Student random variate generator with degrees of freedom, using stream s.
static double nextDouble(RandomStream s, int n)
Generates a new variate from the Student distribution with &#160;n degrees of freedom,...
int getN()
Returns the value of for this object.
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,...