Skip to content

aivi.random

Randomness vocabulary plus the RandomSource capability-handle type.

Public randomness now goes through @source random handles rather than standalone imports.

Import

aivi
use aivi.random (
    RandomSource
    RandomError
    InsufficientEntropy
)

Capability handle

aivi
@source random
signal entropy : RandomSource

value dieRoll : Task Text Int = entropy.int 1 6
value csrfSeed : Task Text Bytes = entropy.bytes 32
value normalized : Task Text Float = entropy.float

Exported vocabulary

  • RandomSource - nominal handle annotation for @source random.
  • RandomError / InsufficientEntropy - structured randomness failure vocabulary.

Canonical handle members

MemberTypeDescription
entropy.int low highTask Text IntGenerate a whole number in the requested range
entropy.bytes countTask Text BytesGenerate random bytes
entropy.floatTask Text FloatGenerate a random floating-point value

The compiler still accepts longer compatibility spellings such as randomInt, randomBytes, and randomFloat on the handle surface, but the docs prefer the shorter member names.

(c) 2026 by Andreas Herd