You are here

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

Generate a random integer of the given character length.

Parameters

int $length: Length of returned value.

Return value

int Random integer of given length.

Throws

\Exception

File

src/TfaRandomTrait.php, line 43

Class

TfaRandomTrait
Trait TfaRandomTrait for generating cryptographically secure random data.

Namespace

Drupal\tfa

Code

public function randomInteger($length) {
  return $this
    ->randomCharacters($length, $this->allowedRandomNumbers);
}