View Javadoc
1   package nl.tudelft.simulation.jstats.distributions;
2   
3   import nl.tudelft.simulation.jstats.streams.StreamInterface;
4   
5   /**
6    * The discrete distribution. For more information on this distribution see
7    * <a href="https://mathworld.wolfram.com/DiscreteDistribution.html"> https://mathworld.wolfram.com/DiscreteDistribution.html
8    * </a>
9    * <p>
10   * Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
11   * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
12   * project is distributed under a three-clause BSD-style license, which can be found at
13   * <a href="https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
14   * </p>
15   * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
16   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
17   */
18  public abstract class DistDiscrete extends Dist
19  {
20      /** */
21      private static final long serialVersionUID = 1L;
22  
23      /**
24       * constructs a new discrete distribution.
25       * @param stream StreamInterface; the random number stream
26       */
27      public DistDiscrete(final StreamInterface stream)
28      {
29          super(stream);
30      }
31  
32      /**
33       * draws the next long from the stream.
34       * @return long
35       */
36      public abstract long draw();
37  
38      /**
39       * returns the probability of the observation in this particular distribution.
40       * @param observation long; the discrete observation.
41       * @return double the probability.
42       */
43      public abstract double probability(long observation);
44  }