A generic method that can return a random integer between 2 parameters like ruby does with rand(0..n).
rand(0..n)
Any suggestion?
Using a top-level function, you can achieve exactly the same call syntax as in Ruby (as you wish):
fun rand(s: Int, e: Int) = Random.nextInt(s, e + 1)
Usage:
rand(1, 3) // returns either 1, 2 or 3