Skip to content
class method

OpenSSL::Random.random_bytes

(::Integer length) -> ::String
random_bytes(length) → string

Generates a String with length number of cryptographically strong pseudo-random bytes.

Example

Example
OpenSSL::Random.random_bytes(12)
#=> "..."
See also .random_add .seed .load_random_file .status? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0