Pprob:
Filter:
Classes | Streams-Patterns-Events > Patterns > Random

Pprob : Pattern : AbstractFunction : Object

random values with arbitrary probability distribution
Source: Patterns.sc

Description

Creates an integral table on instantiation (cpu intensive) which is then used by the streams to generate random values efficiently.

Class Methods

Pprob.new(distribution, lo: 0.0, hi: 1.0, length: inf, tableSize)

Arguments:

distribution

desired probability distribution (histogram).

lo

lower bound of the resulting values.

hi

upper bound of the resulting values.

length

number of values to repeat.

tableSize

resample table to this size. If the size of the distribution is smaller than 64, it is (linearly) resampled to this minimum size.

(distribution)

set the distribution, the table is recalculated.

(tableSize)

set the resample size, the table is recalculated.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

.distribution

.distribution = list

.embedInStream(inval)

.hi

.hi = value

.length

.length = value

.lo

.lo = value

.table

.tableSize

.tableSize = n

Examples