Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.util.distribution
Class Uniform

    java.lang.Object
      sim.util.distribution.AbstractDistribution
          sim.util.distribution.AbstractContinousDistribution
              sim.util.distribution.Uniform

All Implemented Interfaces:
  java.io.Serializable

    public class Uniform

extends AbstractContinousDistribution

Uniform distribution; Math definition and animated definition.

Instance methods operate on a user supplied uniform random number generator; they are unsynchronized.

Static methods operate on a default uniform random number generator; they are synchronized.

See Also:
  Serialized Form

Field Summary
`protected double` | `max`
`protected double` | `min`

Fields inherited from class sim.util.distribution.AbstractDistribution
`randomGenerator`

Constructor Summary
`Uniform(double min, double max, MersenneTwisterFast randomGenerator)` Constructs a uniform distribution with the given minimum and maximum.
`Uniform(MersenneTwisterFast randomGenerator)` Constructs a uniform distribution with `min=0.0` and `max=1.0`.

Method Summary
`double` | `cdf(double x)` Returns the cumulative distribution function (assuming a continous uniform distribution).
`boolean` | `nextBoolean()` Returns a uniformly distributed random `boolean`.
`double` | `nextDouble()` Returns a uniformly distributed random number in the open interval `(min,max)` (excluding `min` and `max`).
`double` | `nextDoubleFromTo(double from, double to)` Returns a uniformly distributed random number in the open interval `(from,to)` (excluding `from` and `to`).
`float` | `nextFloatFromTo(float from, float to)` Returns a uniformly distributed random number in the open interval `(from,to)` (excluding `from` and `to`).
`int` | `nextInt()` Returns a uniformly distributed random number in the closed interval `[min,max]` (including `min` and `max`).
`int` | `nextIntFromTo(int from, int to)` Returns a uniformly distributed random number in the closed interval `[from,to]` (including `from` and `to`).
`long` | `nextLongFromTo(long from, long to)` Returns a uniformly distributed random number in the closed interval `[from,to]` (including `from` and `to`).
`double` | `pdf(double x)` Returns the probability distribution function (assuming a continous uniform distribution).
`void` | `setState(double min, double max)` Sets the internal state.
`java.lang.String` | `toString()` Returns a String representation of the receiver.

Methods inherited from class sim.util.distribution.AbstractDistribution
`apply, apply, getRandomGenerator, setRandomGenerator`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### min

    protected double min

### max

    protected double max

Constructor Detail

### Uniform

    public Uniform(double min,
                   double max,
                   MersenneTwisterFast randomGenerator)

  Constructs a uniform distribution with the given minimum and maximum.

### Uniform

    public Uniform(MersenneTwisterFast randomGenerator)

  Constructs a uniform distribution with `min=0.0` and `max=1.0`.

Method Detail

### cdf

    public double cdf(double x)

  Returns the cumulative distribution function (assuming a continous uniform distribution).

### nextBoolean

    public boolean nextBoolean()

  Returns a uniformly distributed random `boolean`.

### nextDouble

    public double nextDouble()

  Returns a uniformly distributed random number in the open interval `(min,max)` (excluding `min` and `max`).

  Specified by:
    `nextDouble` in class `AbstractDistribution`

### nextDoubleFromTo

    public double nextDoubleFromTo(double from,
                                   double to)

  Returns a uniformly distributed random number in the open interval `(from,to)` (excluding `from` and `to`). Pre conditions: `from <= to`.

### nextFloatFromTo

    public float nextFloatFromTo(float from,
                                 float to)

  Returns a uniformly distributed random number in the open interval `(from,to)` (excluding `from` and `to`). Pre conditions: `from <= to`.

### nextInt

    public int nextInt()

  Returns a uniformly distributed random number in the closed interval `[min,max]` (including `min` and `max`).

  Overrides:
    `nextInt` in class `AbstractDistribution`

### nextIntFromTo

    public int nextIntFromTo(int from,
                             int to)

  Returns a uniformly distributed random number in the closed interval `[from,to]` (including `from` and `to`). Pre conditions: `from <= to`.

### nextLongFromTo

    public long nextLongFromTo(long from,
                               long to)

  Returns a uniformly distributed random number in the closed interval `[from,to]` (including `from` and `to`). Pre conditions: `from <= to`.

### pdf

    public double pdf(double x)

  Returns the probability distribution function (assuming a continous uniform distribution).

### setState

    public void setState(double min,
                         double max)

  Sets the internal state.

### toString

    public java.lang.String toString()

  Returns a String representation of the receiver.

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD