Module: OAuth2::Provider::Random

Defined in:
lib/oauth2/provider/random.rb

Defined Under Namespace

Modules: Base62

Class Method Summary collapse

Class Method Details

.base36(length = 8) ⇒ Object



26
27
28
# File 'lib/oauth2/provider/random.rb', line 26

def base36(length = 8)
  SecureRandom.random_number(36 ** length).to_s(36).rjust(length, '0')
end

.base62(length = 8) ⇒ Object



21
22
23
24
# File 'lib/oauth2/provider/random.rb', line 21

def base62(length = 8)
  number = SecureRandom.random_number(62 ** length)
  Base62.encode(number).rjust(length, '0')
end