# 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
assume Attach a distribution to this random variable.
value Get the value of the random variable, forcing realization if necessary.
realize Set the value of the random variable.
hasValue Does this have a value?
hasDistribution Does this have a distribution?
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>)

Attach a distribution to this random variable.

#### cdf

function cdf(x:Value) -> Real

Evaluate the cumulative distribution function at a value.

• x: The value.

Return: the cumulative probability

#### 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.

#### realize

function realize(x:Value) -> Real

Set the value of the random variable.

• x: The value.

Return: The log likelihood.

#### 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 variable, forcing realization if necessary.