# Random

class Random<Value> < Expression<Value>

Random variate.

• Value: Value type.

### Factory Functions

Name Description
Random Create random variate with attached distribution.
Random Create random variate with attached distribution.
Random Create random variate with attached distribution.
Random Create random variate with attached distribution.
Random Create random variate with attached distribution.
Random Create random variate with attached distribution.

### Assignments

Name Description
Value Value assignment.
Value? Optional value assignment.

### Member Variables

Name Description
x:Value? Value.
dist:Distribution<Value>? Associated distribution.

### Member Functions

Name Description
hasValue Does this have a value?
hasDistribution Does this have a distribution?
value Get the value of the random variate, forcing realization if necessary.
distribution Get the distribution.
assume Assume a distribution for this random variate.
assumeUpdate Assume a distribution for this random variate.
assumeDowndate Assume a distribution for this random variate.
pmf Evaluate the probability mass function (if it exists) at a value.
pdf Evaluate the probability density function (if it exists) at a value.
cdf Evaluate the cumulative distribution function at a value.
lower Finite lower bound of the support of this node, if any.
upper Finite upper bound of the support of this node, if any.

### Factory Function Details

function Random(dist:Distribution<Boolean>) -> Random<Boolean>

Create random variate with attached distribution.

function Random(dist:Distribution<Integer>) -> Random<Integer>

Create random variate with attached distribution.

function Random(dist:Distribution<Real>) -> Random<Real>

Create random variate with attached distribution.

function Random(dist:Distribution<Boolean[_]>) -> Random<Boolean[_]>

Create random variate with attached distribution.

function Random(dist:Distribution<Integer[_]>) -> Random<Integer[_]>

Create random variate with attached distribution.

function Random(dist:Distribution<Real[_]>) -> Random<Real[_]>

Create random variate with attached distribution.

### Member Function Details

#### assume

function assume(dist:Distribution<Value>)

Assume a distribution for this random variate. When a value is required, it will be simuldated from this distribution.

#### assumeDowndate

function assumeDowndate(dist:Distribution<Value>, future:Value)

Assume a distribution for this random variate. When a value is required, it will be assigned according to the future value given here, and trigger a downdate on the delayed sampling graph.

• dist: The distribution.
• future: The future value.

#### assumeUpdate

function assumeUpdate(dist:Distribution<Value>, future:Value)

Assume a distribution for this random variate. When a value is required, it will be assigned according to the future value given here, and trigger an update on the delayed sampling graph.

• dist: The distribution.
• future: The future value.

#### cdf

function cdf(x:Value) -> Real

Evaluate the cumulative distribution function at a value.

• x: The value.

Return: the cumulative probability

#### distribution

function distribution() -> Distribution<Value>

Get the distribution.

#### hasDistribution

function hasDistribution() -> Boolean

Does this have a distribution?

#### hasValue

function hasValue() -> Boolean

Does this have a value?

#### lower

function lower() -> Value?

Finite lower bound of the support of this node, if any.

#### pdf

function pdf(x:Value) -> Real

Evaluate the probability density function (if it exists) at a value.

• x: The value.

Return: the probability density.

#### pmf

function pmf(x:Value) -> Real

Evaluate the probability mass function (if it exists) at a value.

• x: The value.

Return: the probability mass.

#### upper

function upper() -> Value?

Finite upper bound of the support of this node, if any.

#### value

function value() -> Value

Get the value of the random variate, forcing realization if necessary.