Created
February 16, 2019 09:07
-
-
Save softberries/7d9c45ac33c336961ddbd3a1a0db2ba2 to your computer and use it in GitHub Desktop.
This file contains 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
import java.util.concurrent.ThreadLocalRandom | |
val random: ThreadLocalRandom = ThreadLocalRandom.current() | |
def getNumber(): (Int, Int) = { | |
val n = random.nextLong(1,100) | |
val d = random.nextLong(1,10) | |
if(n % d == 0 && n / d < 11 && n != d) (n.toInt, d.toInt) | |
else getNumber() | |
} | |
(1 to 100).foreach { _ => | |
val nums = getNumber | |
println(nums._1 + " / " + nums._2 + " = ......") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment