You are here

public function TfaRandomTrait::randomString in Two-factor Authentication (TFA) 8

Generate a random string of the given character length.

Parameters

int $length: Length of returned value.

Return value

string Random integer of given length.

Throws

\Exception

File

src/TfaRandomTrait.php, line 58

Class

TfaRandomTrait
Trait TfaRandomTrait for generating cryptographically secure random data.

Namespace

Drupal\tfa

Code

public function randomString($length) {
  return $this
    ->randomCharacters($length, $this->allowedRandomLetters);
}