# Random numbers.

.

`randomstd/num/random/random: HX` effect.

fun choose( x : a, y : a ) : ndetstd/core/types/ndet: X a

Returns one of its arguments `xstd/num/random/x: (sfc : sfc) -> int32` or `ystd/num/random/y: (sfc : sfc) -> int32` based on a non-deterministic choice.

( seed : intstd/core/types/int: V, action : () -> <randomstd/num/random/random: HX|e> a ) : e a

Use pseudo random numbers given some initial `seed`. At most 64-bits of the initial seed are used. Do not use this for cryptographic applications (use `strong-randomstd/num/random/strong-random: forall<a,e> (action : () -> <random,ndet|e> a) -> <ndet|e> a` instead). Uses sfc32 by Chris Doty-Humphrey which is a fast random number generator with a 128-bit internal state which passes PractRand and BigCrush. The worst case minimum cycle is 2^32, where a potential cycle of 248^ has a chance of 2^-80^.

Return a random boolean.

Return a random double in the range [0,1) using 52-bits of randomness.

Return a random integer in the range [-2^31, 231^).

call `random-int32std/num/random/random-int32: () -> random int32` operation of the `randomstd/num/random/random: HX` effect.

Return a strong random boolean.

Return a strong random `doublestd/core/types/double: V` in the range [0,1) using 52-bits of randomness.

Generate a strong random double uniformly distributed in the range [lo, hi).

Return a strong random integer in the range [-2^31, 231^).

Return a strong random `int32std/core/types/int32: V`.

Return a strong random `int32std/core/types/int32: V` uniformly distributed in the range [lo,hi).

Are the strong random numbers generated from a strong random source? (like /dev/urandom).

( action : () -> <randomstd/num/random/random: HX,ndetstd/core/types/ndet: X|e> a ) : <ndetstd/core/types/ndet: X|e> a

Pick random numbers from a the best strong random source in the OS. (e.g. like `/dev/urandom`, `arc4random` etc.). Use `srandom-is-strongstd/num/random/srandom-is-strong: () -> ndet bool` to test if the numbers are indeed based on a strong random source.