# The Random\Randomizer class

(PHP 8 >= 8.2.0)

## Introduction

Provides a high-level API to the randomness provided by an Random\Engine.

## Class synopsis

namespace Random;
final class Randomizer {
/* Properties */
public readonly Random\Engine $engine;
/* Methods */
public Random\Randomizer::__construct(?Random\Engine `$engine` = `null`)
public Random\Randomizer::getBytes(int `$length`): string
public Random\Randomizer::getBytesFromString(string `$string`, int `$length`): string
public Random\Randomizer::getFloat(float `$min`, float `$max`, Random\IntervalBoundary `$boundary` = `Random\IntervalBoundary::ClosedOpen`): float
public Random\Randomizer::getInt(int `$min`, int `$max`): int
public Random\Randomizer::nextFloat(): float
public Random\Randomizer::nextInt(): int
public Random\Randomizer::pickArrayKeys(array `$array`, int `$num`): array
public Random\Randomizer::__serialize(): array
public Random\Randomizer::shuffleArray(array `$array`): array
public Random\Randomizer::shuffleBytes(string `$bytes`): string
public Random\Randomizer::__unserialize(array `$data`): void
}

## Properties

engine

  The low-level source of randomness for the Random\Randomizer’s methods.

## Table of Contents

- Random\Randomizer::__construct — Constructs a new Randomizer
- Random\Randomizer::getBytes — Get random bytes
- Random\Randomizer::getBytesFromString — Get random bytes from a source string
- Random\Randomizer::getFloat — Get a uniformly selected float
- Random\Randomizer::getInt — Get a uniformly selected integer
- Random\Randomizer::nextFloat — Get a float from the right-open interval [0.0, 1.0)
- Random\Randomizer::nextInt — Get a positive integer
- Random\Randomizer::pickArrayKeys — Select random array keys
- Random\Randomizer::__serialize — Serializes the Randomizer object
- Random\Randomizer::shuffleArray — Get a permutation of an array
- Random\Randomizer::shuffleBytes — Get a byte-wise permutation of a string
- Random\Randomizer::__unserialize — Deserializes the data parameter into a Randomizer object

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open