HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelibsodium-bindings-0.0.1.1Haskell2010

LibSodium.Bindings.Random

A collection of functions for securely generating unpredictable data. This uses the best option on each platform, as follows:

  • On Windows, RtlGenRandom.

  • On FreeBSD and Linux, getrandom syscall.

  • On other UNIX platforms, /dev/urandom.

  • 3 values
valuerandombytesUniform
  1. :: Word32

    upper limit (exclusive)

  2. -> IO Word32
#

Produces an unpredictable four-byte value not larger than the argument. This function guarantees a uniform distribution on results, even if the upper limit is not a power of 2.

See: randombytes_uniform()