from plugin import plugin
import random

@plugin("random number")
def random_password(jarvis, s):
    stringFail = True

    while (stringFail):
        try:
            smallest_number = int(input("Enter the smallest number possible: "))
            higher_number = int(input("Enter the higher number possible: "))
            stringFail = False
        except:
            print('Only integers will be accepted')

    """If the user change the order of input"""
    if(higher_number < smallest_number):
        aux = higher_number
        higher_number = smallest_number
        smallest_number = aux

    preText = "Your random number is";
    random_number = random.randint(smallest_number,higher_number+1)
    print(preText, random_number)
@@ -67,23 +67,30 @@
 def 
-random_password
+generate_random_number
 (jar
@@ -102,54 +102,65 @@
 s):%0A
+%0A
     
-stringFail = True%0A%0A    while (stringFail):
+if s != %22%22:%0A        input_numbers = s.split(' ', 1)%0A
 %0A   
@@ -212,126 +212,86 @@
 nput
-(%22Enter the smallest number possible: %22))%0A            higher_number = int(input(%22Enter the higher number possible: %22))
+_numbers%5B0%5D)%0A            higher_number = int(input_numbers%5B1%5D)%0A        except:
 %0A   
@@ -303,93 +303,172 @@
     
-stringFail = False%0A        except:%0A            print('Only integers will be accepted'
+print('Values are invalid please:')%0A            smallest_number, higher_number = get_user_input()%0A    else:%0A        smallest_number, higher_number = get_user_input(
 )%0A%0A 
@@ -520,17 +520,17 @@
 %22%0A    if
-(
+ 
 higher_n
@@ -552,17 +552,16 @@
 t_number
-)
 :%0A      
@@ -664,16 +664,17 @@
  pre
-T
+_t
 ext = 
-%22
+'
 Your
@@ -693,10 +693,63 @@
 er i
-s%22
+n range %5B%25d, %25d%5D is' %25 (smallest_number, higher_number)
 ;%0A  
@@ -750,26 +750,24 @@
 r);%0A    rand
-om
 _number = ra
@@ -795,16 +795,17 @@
 _number,
+ 
 higher_n
@@ -813,10 +813,8 @@
 mber
-+1
 )%0A  
@@ -828,9 +828,10 @@
 (pre
-T
+_t
 ext,
@@ -839,14 +839,12 @@
 rand
-om
 _number)
@@ -835,16 +835,561 @@
 xt, rand_number)
+%0A%0A%0Adef get_user_input():%0A    string_fail = True%0A    while string_fail:%0A        try:%0A            smallest_number = int(input('Enter the smallest number possible: '))%0A            string_fail = False%0A        except:%0A            print('Only integers will be accepted')%0A%0A    string_fail = True%0A%0A    while string_fail:%0A        try:%0A            higher_number = int(input('Enter the higher number possible: '))%0A            string_fail = False%0A        except:%0A            print('Only integers will be accepted')%0A%0A    return smallest_number,higher_number;

make the functions more modular