Disponible

amalgame-random

PCG-32 + entropie crypto-grade.

amc package add random GitHub ↗ ← Retour à l'écosystème

Vue d'ensemble

Deux APIs : Random (PCG-32, déterministe avec seed) pour simulations et tests, et CryptoRandom (lecture de /dev/urandom sur Unix, BCryptGenRandom sur Windows) pour tout ce qui a besoin d'aléa non-prédictible.

Caractéristiques

  • Random : PCG-32, déterministe via Seed(n)
  • CryptoRandom : entropie OS pour secrets/IDs
  • Int, Float01, Bytes(n), Choice(list)
  • Shuffle Fisher-Yates in-place
  • Pure Amalgame (sauf l'appel système d'entropie)

Exemple

Exemple minimal d'utilisation — recopiable tel quel après l'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 d'entropie OS

En bref

Packages liés