SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
ConstantDist.java
1/*
2 * Class: ConstantDist
3 * Description: constant 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 Éric Buist
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.probdist;
26
42public class ConstantDist extends DiscreteDistribution {
43 private double c;
44
48 public ConstantDist(double c) {
49 super(new double[] { c }, new double[] { 1.0 }, 1);
50 this.c = c;
51 }
52
58 @Override
59 public double getMean() {
60 return c;
61 }
62
68 @Override
69 public double getVariance() {
70 return 0;
71 }
72
78 @Override
79 public double getStandardDeviation() {
80 return 0;
81 }
82
88 @Override
89 public double inverseF(double u) {
90 return c;
91 }
92
93}
ConstantDist(double c)
Constructs a new constant distribution with probability 1 at c.
double getMean()
Returns the mean .
double getStandardDeviation()
Returns the standard deviation = 0.
double getVariance()
Returns the variance .
double inverseF(double u)
Returns the inverse distribution function .