Random::Secure - Crystal 1.16.3

# module Random::Secure

##
Overview

`Random::Secure` generates random numbers from a secure source provided by the system.

It uses a cryptographically secure pseudorandom number generator (CSPRNG) for cryptography and secure usages such as generating secret keys, or to seed another pseudorandom number generator (PRNG).

    Random::Secure.rand(6)            # => 4
    [1, 5, 6].shuffle(Random::Secure) # => [6, 1, 5]

On BSD-based systems and macOS/Darwin, it uses `arc4random`, on Linux `getrandom`, on Windows `RtlGenRandom`, and falls back to reading from `/dev/urandom` on UNIX systems.

##
Extended Modules

- Random
- Random::Secure

##
Defined in:

random/secure.cr

##
Instance Method Summary

- #next_u
- #random_bytes(buf : Bytes) : Nil

##
Instance Method Detail

def next_u #
def random_bytes(buf : Bytes) : Nil #