You are here

static function handler::generateRandom in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

File

src/handler.php, line 4

Class

handler

Namespace

Drupal\miniorange_oauth_client

Code

static function generateRandom($length = 30) {
  $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  $charactersLength = strlen($characters);
  $randomString = '';
  for ($i = 0; $i < $length; $i++) {
    $randomString .= $characters[rand(0, $charactersLength - 1)];
  }
  return $randomString;
}