Skip to content

Random

final class Random<Value> < Expression<Value>

Random variate.

  • Value: Value type.

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.
observe Observe the value of the random variate.
distribution Get the distribution associated with the random variate.
logpdf Evaluate the log probability density (or mass) function, if it exists.
pdf Evaluate the probability density (or mass) function, if it exists.
cdf Evaluate the cumulative distribution function at a value.
quantile Evaluate the quantile function at a cumulative probability.
lower Finite lower bound of the support of this node, if any.
upper Finite upper bound of the support of this node, if any.

Member Function Details

cdf

function cdf(x:Value) -> Real?

Evaluate the cumulative distribution function at a value.

  • x: The value.

Return: the cumulative probability, if supported.

distribution

function distribution() -> Distribution<Value>

Get the distribution associated with the random variate.

hasDistribution

function hasDistribution() -> Boolean

Does this have a distribution?

hasValue

function hasValue() -> Boolean

Does this have a value?

logpdf

function logpdf(x:Value) -> Real

Evaluate the log probability density (or mass) function, if it exists.

  • x: The value.

Return: the log probability density (or mass).

lower

function lower() -> Value?

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

observe

function observe(x:Value) -> Real

Observe the value of the random variate.

pdf

function pdf(x:Value) -> Real

Evaluate the probability density (or mass) function, if it exists.

  • x: The value.

Return: the probability density (or mass).

quantile

function quantile(p:Real) -> Value?

Evaluate the quantile function at a cumulative probability.

  • x: The cumulative probability.

Return: the quantile value, if supported.

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.