Debian Codegraph @

src/Data/Nat/PseudoRandom/LCG/Unsafe.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Unsafe operations over linear congruential pseudo random generators
5 -- for natural numbers
6 -- /!\ NB: LCGs must not be used for cryptographic applications
7 ------------------------------------------------------------------------
8
9 {-# OPTIONS --cubical-compatible --sized-types #-}
10
11 open import Codata.Sized.Stream using (Stream; unfold)
12 open import Data.Nat.PseudoRandom.LCG using (Generator; step)
13 open import Data.Nat.Base using (ℕ)
14 open import Data.Product.Base using (<_,_>)
15 open import Function.Base using (id)
16
17 module Data.Nat.PseudoRandom.LCG.Unsafe where
18
19 ------------------------------------------------------------------------
20 -- An infinite stream of random numbers
21
22 stream : Generator → ℕ → Stream ℕ _
23 stream gen = unfold < step gen , id >