Available

amalgame-random

PCG-32 + crypto-grade entropy.

amc package add random GitHub ↗ ← Back to the ecosystem

Overview

Two APIs: Random (PCG-32, deterministic with seed) for simulations and tests, and CryptoRandom (reads /dev/urandom on Unix, BCryptGenRandom on Windows) for anything needing unpredictable randomness.

Features

  • Random: PCG-32, deterministic via Seed(n)
  • CryptoRandom: OS entropy for secrets/IDs
  • Int, Float01, Bytes(n), Choice(list)
  • Shuffle in-place Fisher-Yates
  • Pure Amalgame (except the system entropy call)

Example

Minimal usage example — copy-paste runnable after install.

amc package add random

let r = Random.Seed(42)
let rolls = [r.IntRange(1, 6) for _ in 0..10]

let id = CryptoRandom.Hex(16)  // 256 bits of OS entropy

At a glance

Related packages