# OPENSSL-RAND(1SSL) - man - phpMan

[OPENSSL-RAND(1SSL)](https://www.chedong.com/phpMan.php/man/OPENSSL-RAND/1SSL/markdown)                             OpenSSL                            [OPENSSL-RAND(1SSL)](https://www.chedong.com/phpMan.php/man/OPENSSL-RAND/1SSL/markdown)



## NAME
       openssl-rand - generate pseudo-random bytes

## SYNOPSIS
       **openssl** **rand** [**-help**] [**-out** _file_] [**-base64**] [**-hex**] [**-engine** _id_] [**-rand** _files_] [**-writerand**
       _file_] [**-provider** _name_] [**-provider-path** _path_] [**-propquery** _propq_] _num_

## DESCRIPTION
       This command generates _num_ random bytes using a cryptographically secure pseudo random number
       generator (CSPRNG).

       The random bytes are generated using the **RAND**___**[bytes**(3)](https://www.chedong.com/phpMan.php/man/bytes/3/markdown) function, which provides a security
       level of 256 bits, provided it managed to seed itself successfully from a trusted operating
       system entropy source.  Otherwise, the command will fail with a nonzero error code.  For more
       details, see **RAND**___**[bytes**(3)](https://www.chedong.com/phpMan.php/man/bytes/3/markdown), [**RAND**(7)](https://www.chedong.com/phpMan.php/man/RAND/7/markdown), and **EVP**___**[RAND**(7)](https://www.chedong.com/phpMan.php/man/RAND/7/markdown).

## OPTIONS
### -help
           Print out a usage message.

### -out
           Write to _file_ instead of standard output.

### -base64
           Perform base64 encoding on the output.

### -hex
           Show the output as a hex string.

### -engine
           See "Engine Options" in [**openssl**(1)](https://www.chedong.com/phpMan.php/man/openssl/1/markdown).  This option is deprecated.

### -rand -writerand
           See "Random State Options" in [**openssl**(1)](https://www.chedong.com/phpMan.php/man/openssl/1/markdown) for details.

### -provider
### -provider-path
### -propquery
           See "Provider Options" in [**openssl**(1)](https://www.chedong.com/phpMan.php/man/openssl/1/markdown), [**provider**(7)](https://www.chedong.com/phpMan.php/man/provider/7/markdown), and [**property**(7)](https://www.chedong.com/phpMan.php/man/property/7/markdown).

## SEE ALSO
       [**openssl**(1)](https://www.chedong.com/phpMan.php/man/openssl/1/markdown), **RAND**___**[bytes**(3)](https://www.chedong.com/phpMan.php/man/bytes/3/markdown), [**RAND**(7)](https://www.chedong.com/phpMan.php/man/RAND/7/markdown), **EVP**___**[RAND**(7)](https://www.chedong.com/phpMan.php/man/RAND/7/markdown)

## HISTORY
       The **-engine** option was deprecated in OpenSSL 3.0.

## COPYRIGHT
       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

       Licensed under the Apache License 2.0 (the "License").  You may not use this file except in
       compliance with the License.  You can obtain a copy in the file LICENSE in the source
       distribution or at <<https://www.openssl.org/source/license.html>>.



3.0.2                                        2026-04-07                           [OPENSSL-RAND(1SSL)](https://www.chedong.com/phpMan.php/man/OPENSSL-RAND/1SSL/markdown)
