generateRandomString() public method

If $chars param is empty, the string will be generated using numbers, letters and special characters.
public generateRandomString ( integer $length, string $chars = '' ) : string
$length integer Length of the generated string.
$chars string A string containing a list of chars that will be uses for generating the random string.
return string Random string with the given $length containing only the provided set of $chars.
Beispiel #1
0
 public function testGenerateRandomString()
 {
     $crypt = new Crypt();
     $randomString = $crypt->generateRandomString(9, 'abc');
     $this->assertInternalType('string', $randomString);
 }