Guest User

Untitled

a guest
Oct 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. puts "Give me a min number less than 100"
  2. min_no = gets.chomp.to_i
  3.  
  4. puts "Now give me a max number up to 100"
  5. max_no = gets.chomp.to_i
  6.  
  7. if min_no > max_no
  8. puts "Error. Your maximum number should be higher than your minimum number. Start over. Womp, womp"
  9. exit
  10. end
  11.  
  12. puts "How many numbers should I generate?"
  13. numbers = gets.chomp.to_i
  14.  
  15. puts "Selecting #{numbers} numbers between #{min_no} and #{max_no}!"
  16. randinput = max_no - min_no + 1
  17.  
  18. results = []
  19. numbers.times { results << (rand(randinput) + min_no)}
  20.  
  21. print results.join(", ")
Add Comment
Please, Sign In to add comment