Dokumentacija

Verjetnost, šum in blaženje

Vsak operator, ki ga program .lolo lahko pokliče, iz kanoničnega registra, ki ga prevajalnik vgradi.

Imenski prostori na tej strani: anim/, ease/, noise/, prob/.

anim/

anim/direction-from-delta

Facing direction string from (dx,dy); 4-way (default) or 8-way

lolo
1 (anim/direction-from-delta dx dy)

Parametri

ImeTipOpis
dxnumberX delta
dynumberY delta (variadic)

Vrne: string

Primer

lolo
1 (anim/direction-from-delta 1 0) // => "right"

anim/frame-at

Frame index for elapsed time; loops by default, else clamps to last

lolo
1 (anim/frame-at elapsed frameCount frameDuration)

Parametri

ImeTipOpis
elapsednumberElapsed time
frameCountnumberTotal frame count
frameDurationnumberDuration per frame (variadic)

Vrne: number

Primer

lolo
1 (anim/frame-at 1000 8 100) // => 2

anim/sheet-rect

Source rect {sx,sy,sw,sh} for a frame index on a sprite sheet

lolo
1 (anim/sheet-rect frameIdx frameW frameH sheetW)

Parametri

ImeTipOpis
frameIdxnumberFrame index
frameWnumberFrame width
frameHnumberFrame height
sheetWnumberSheet width

Vrne: object

Primer

lolo
1 (anim/sheet-rect 1 32 32 128) // => {"sx": 32, "sy": 0, "sw": 32, "sh": 32}

ease/

ease/apply

Apply an easing curve to t∈[0,1]: linear, in-quad, out-quad, in-out-quad, in-cubic, out-cubic, in-out-cubic, elastic-out, bounce-out (unknown → linear)

lolo
1 (ease/apply t curve)

Parametri

ImeTipOpis
tnumberTime value in [0, 1]
curvestringEasing curve name

Vrne: number

Primer

lolo
1 (ease/apply 0.5 "in-quad") // => 0.25

ease/smoothstep

Smoothstep: clamp((x-edge0)/(edge1-edge0),0,1) then tt(3-2*t)

lolo
1 (ease/smoothstep x edge0 edge1)

Parametri

ImeTipOpis
xnumberInput value
edge0numberLower edge
edge1numberUpper edge

Vrne: number

Primer

lolo
1 (ease/smoothstep 0.5 0 1) // => 0.5

noise/

noise/fbm

Fractal Brownian motion: summed perlin octaves (clamped 1..8); output [-1,1]

lolo
1 (noise/fbm x y octaves)

Parametri

ImeTipOpis
xnumberX coordinate
ynumberY coordinate
octavesnumberOctave count (variadic)

Vrne: number

Primer

lolo
1 (noise/fbm 0.5 0.3 4) // => 0.234

noise/perlin

2D Perlin noise at (x,y) with optional seed; output [-1,1]

lolo
1 (noise/perlin x y)

Parametri

ImeTipOpis
xnumberX coordinate
ynumberY coordinate (variadic)

Vrne: number

Primer

lolo
1 (noise/perlin 0.5 0.3) // => 0.123

noise/simplex

Value-coherent noise (perlin-derived) at (x,y) with optional seed; output [-1,1]

lolo
1 (noise/simplex x y)

Parametri

ImeTipOpis
xnumberX coordinate
ynumberY coordinate (variadic)

Vrne: number

Primer

lolo
1 (noise/simplex 0.5 0.3) // => 0.567

prob/

prob/beta

Sample from a Beta(alpha, beta) distribution

lolo
1 (prob/beta alpha beta)

Parametri

ImeTipOpis
alphanumberShape parameter α > 0
betanumberShape parameter β > 0

Vrne: number

Primer

lolo
1 (prob/beta 2 5) // => value in (0, 1), mean ≈ 0.286

prob/categorical

Weighted random selection from items

lolo
1 (prob/categorical items weights)

Parametri

ImeTipOpis
itemsarrayArray of items to sample from
weightsnumber[]Non-negative weights (need not sum to 1)

Vrne: any

Primer

lolo
1 (prob/categorical (a "b" "c") [1 2 1]) // => "b" ~50%

prob/condition

Mark current sample as rejected if predicate is false

lolo
1 (prob/condition predicate)

Parametri

ImeTipOpis
predicatebooleanCondition that must hold for the sample to be accepted

Vrne: void · Teče na: any

Primer

lolo
1 (prob/condition [">",5,0])

prob/credible-interval

Compute symmetric credible interval from samples

lolo
1 (prob/credible-interval samples alpha)

Parametri

ImeTipOpis
samplesnumber[]Numeric samples
alphanumberSignificance level (e.g. 0.05 for 95% CI)

Vrne: array

Primer

lolo
1 (prob/credible-interval [1,2,3,4,5] 0.05) // => 95% CI

prob/expected-value

Mean of numeric samples

lolo
1 (prob/expected-value samples)

Parametri

ImeTipOpis
samplesnumber[]Array of numeric samples

Vrne: number

Primer

lolo
1 (prob/expected-value [1 2 3 4]) // => 2.5

prob/flip

Bernoulli trial: returns true with probability p

lolo
1 (prob/flip p)

Parametri

ImeTipOpis
pnumberProbability (0.0 to 1.0)

Vrne: boolean

Primer

lolo
1 (prob/flip 0.7) // => true ~70% of the time

prob/gaussian

Sample from a Gaussian (normal) distribution

lolo
1 (prob/gaussian mu sigma)

Parametri

ImeTipOpis
munumberMean
sigmanumberStandard deviation

Vrne: number

Primer

lolo
1 (prob/gaussian 0 1) // => standard normal sample

prob/histogram

Bin numeric samples into a histogram

lolo
1 (prob/histogram samples bins)

Parametri

ImeTipOpis
samplesnumber[]Numeric samples
binsnumberNumber of bins

Vrne: object

Primer

lolo
1 (prob/histogram [1,2,3,4,5] 2)

prob/infer

Like posterior but returns {mean, variance, samples, acceptRate}

lolo
1 (prob/infer model evidence query n)

Parametri

ImeTipOpis
modelexpressionModel expression (lazy)
evidenceexpressionBoolean evidence condition (lazy)
queryexpressionValue to summarize (lazy)
nnumberNumber of simulation runs

Vrne: object

Primer

lolo
1 (prob/infer ["prob/gaussian",0,1] [0.5] "mu" 5000)

prob/percentile

Get the p-th percentile (0-100) from samples

lolo
1 (prob/percentile samples p)

Parametri

ImeTipOpis
samplesnumber[]Numeric samples
pnumberPercentile (0 to 100)

Vrne: number

Primer

lolo
1 (prob/percentile [1,2,3,4,5] 50) // => median

prob/poisson

Sample from a Poisson distribution

lolo
1 (prob/poisson lambda)

Parametri

ImeTipOpis
lambdanumberRate parameter λ > 0

Vrne: number

Primer

lolo
1 (prob/poisson 4) // => integer, mean ≈ 4

prob/posterior

Rejection sampling: returns accepted query values

lolo
1 (prob/posterior model evidence query n)

Parametri

ImeTipOpis
modelexpressionModel expression that sets entity fields (lazy)
evidenceexpressionBoolean evidence condition (lazy)
queryexpressionValue to collect from accepted samples (lazy)
nnumberNumber of simulation runs

Vrne: array

Primer

lolo
1 (prob/posterior ["prob/gaussian",0,1] [0.5] "mu" 5000)

prob/sample

Evaluate an expression n times and collect results

lolo
1 (prob/sample n expr)

Parametri

ImeTipOpis
nnumberNumber of samples
exprexpressionExpression to evaluate (lazy)

Vrne: array

Primer

lolo
1 (prob/sample 1000 (prob/flip 0.5))

prob/seed

Set seeded PRNG for deterministic probabilistic sampling

lolo
1 (prob/seed n)

Parametri

ImeTipOpis
nnumberSeed value

Vrne: void · Teče na: any

Primer

lolo
1 (prob/seed 42)

prob/uniform

Sample from a uniform distribution [lo, hi)

lolo
1 (prob/uniform lo hi)

Parametri

ImeTipOpis
lonumberLower bound (inclusive)
hinumberUpper bound (exclusive)

Vrne: number

Primer

lolo
1 (prob/uniform 0 1) // => value in [0, 1)

prob/variance

Population variance of numeric samples

lolo
1 (prob/variance samples)

Parametri

ImeTipOpis
samplesnumber[]Array of numeric samples

Vrne: number

Primer

lolo
1 (prob/variance [2 4 4 4 5 5 7 9]) // => 4
© 2026 Almadar. Ljubljana, Slovenija.