|
Random\Randomizer::getBytesFromStringGet random bytes from a source string Description
public string Random\Randomizer::getBytesFromString(string
$string , int $length )
Generates a string containing uniformly selected random bytes from the
input
The chance for a byte to be selected is proportional to its share
of the input Parameters
Return Values
A string containing the requested number of random bytes taken from the input Errors/Exceptions
ExamplesExample #1 Random\Randomizer::getBytesFromString example
The above example will output something similar to: 3zsw04eiubcf82jd.example.com Example #2 Generate a random code for multi-factor authentication
The above example will output something similar to: 11551-80418-27047-42075 Example #3 Select from a string with a non-uniform distribution
The above example will output something similar to: fddacbeaaeaaacaaaaca See Also
|