Skip to content
FutureBlitz

    Install

    Import std.crypto.random

    SecureRandom

    std.crypto.random

    struct

    Public Struct SecureRandom

    Random bytes and numbers from the OS's randomness, for keys, tokens, and other secrets.

    Examples

    Local token = SecureRandom.Bytes(16)
    Expect(token.Count == 16)
    Local roll = SecureRandom.Below(6)
    Expect(roll >= 0 && roll < 6)

    std/crypto/random.fb, line 24

    • @PanicsAtCaller Public Static Method Bytes(count: Int): UInt8[] static method #

      count random bytes. Panics when count is negative.

    • @PanicsAtCaller Public Static Method Below(limit: Int64): Int64 static method #

      A random number from 0 up to limit, without limit, each as likely as another. Panics unless limit is above 0.

    Report an issue with this page or with FutureBlitz on GitHub.