Last active
August 29, 2015 14:01
-
-
Save jadon1979/b47feeebc5c31048d6d1 to your computer and use it in GitHub Desktop.
Simple number generator for kid's math worksheets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_problems(total, max) | |
| 1.upto(total).map { |i| num_swap(rand(1..max), rand(1..max)) } | |
| end | |
| def num_swap(a, b) | |
| return [a, b] if a > b | |
| a = a+b | |
| b = a-b | |
| a = a-b | |
| [a, b] | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment