lib/send_otp.rb
def generate_otp(n = 4)
      smallest_num_of_n_plus1_digits = 10 ** n
      smallest_num_of_n_digits = 10 ** (n-1)
      rand_number = generate_random_number(smallest_num_of_n_plus1_digits, smallest_num_of_n_digits)
      while rand_number > smallest_num_of_n_plus1_digits || rand_number < smallest_num_of_n_digits
        rand_number = generate_random_number(smallest_num_of_n_plus1_digits, smallest_num_of_n_digits)
      end

      rand_number
    end
# returns a n digit random number
returns a n digit random number
returns a n digit random number
def generate_otp(n = 4)
      smallest_num_of_n_plus1_digits = 10 ** n
      smallest_num_of_n_digits = 10 ** (n-1)
      rand_number = generate_random_number(smallest_num_of_n_plus1_digits, smallest_num_of_n_digits)
      while rand_number > smallest_num_of_n_plus1_digits || rand_number < smallest_num_of_n_digits
        rand_number = generate_random_number(smallest_num_of_n_plus1_digits, smallest_num_of_n_digits)
      end
      rand_number
    end
def generate_otp ( n = 4 ) smallest_num_of_n_plus1_digits = 10 ** n smallest_num_of_n_digits = 10 ** ( n - 1 ) rand_number = generate_random_number ( smallest_num_of_n_plus1_digits , smallest_num_of_n_digits ) while rand_number > smallest_num_of_n_plus1_digits || rand_number < smallest_num_of_n_digits rand_number = generate_random_number ( smallest_num_of_n_plus1_digits , smallest_num_of_n_digits ) end rand_number end
returns a n digit random number
returns a n digit random number
n