Random\Randomizer::shuffleBytes

(PHP 8 >= 8.2.0)

Random\Randomizer::shuffleBytesGet a byte-wise permutation of a string

Beschreibung

public Random\Randomizer::shuffleBytes(string $bytes): string

Returns a uniformly selected permutation of the input bytes.

Each possible permutation of the input bytes is equally likely to be returned.

Parameter-Liste

bytes

The String whose bytes are shuffled.

The input String will not be modified.

Rückgabewerte

A permutation of the bytes of bytes.

Fehler/Exceptions

Beispiele

Beispiel #1 Random\Randomizer::shuffleBytes() example

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

// Shuffle bytes in a string:
echo '«', $r->shuffleBytes( "PHP is great!" ), "»\n";
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

« ga rHs!PPiet»
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top