HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulelibsodium-bindings-0.0.3.0Haskell2010

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()