php8.5
Home/ Manual/ random / randomizer/ Random\Randomizer::__construct

Random\Randomizer::__construct

PHP function Edit on GitHub ✎

(PHP 8 >= 8.2.0)

Constructs a new Randomizer

Description

Random\Randomizer::__construct(Random\Engine|null $engine = null)

Func

Parameters

engine

The Random\Engine to use to generate randomness.

If engine is omitted or null, a new Random\Engine\Secure object will be used.

Examples

Random\Randomizer::__construct() example

php
<?php
$r = new \Random\Randomizer();
$r = new \Random\Randomizer(new \Random\Engine\Mt19937());
?>

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