php8.5
Home/ Manual/ reference / random/ The Random\Engine\Secure class

The Random\Engine\Secure class

Generates cryptographically secure randomness using the operating system’s CSPRNG.

Intro

Generates cryptographically secure randomness using the operating system’s CSPRNG.

The randomness generated by this Random\Engine is suitable for all applications, including the generation of long-term secrets, such as encryption keys.

The Random\Engine\Secure engine is the recommended safe default choice, unless the application requires either reproducible sequences or very high performance.

Class synopsis

Random\EnginefinalSecureimplementsRandom\CryptoSafeEngineMethods

Secure

Source: reference/random/random.engine.secure.xml · from the official PHP manual (php/doc-en)