Skip to content


final class Random<Value> < Expression<Value>(nil)

Random variate.

  • Value: Value type.

Random objects, like all Expression objects, are stateful. Random objects in the pilot state are considered variables, meaning that a call to grad() will compute gradients with respect to them, and a further call to move() will apply a Markov kernel to update their value. Random objects in the value state are considered constants.


Name Description
Value Value assignment.
Value? Optional assignment.

Member Variables

Name Description
p:Distribution<Value>? Associated distribution.
d:Value? Accumulated gradient.

Member Functions

Name Description
hasDistribution Does this have a distribution?
getDistribution Get the distribution.
assume Assume the distribution for the random variate.

Member Function Details


function assume(p:Distribution<Value>)

Assume the distribution for the random variate. When a value for the random variate is required, it will be simulated from this distribution and trigger an update on the delayed sampling graph.

  • p: The distribution.


function getDistribution() -> Distribution<Value>

Get the distribution.


function hasDistribution() -> Boolean

Does this have a distribution?