scala.mathパッケージのメソッドを使用
0~9でランダムな値を出力
10の値をnにすれば0~n-1でランダムな値を出力
rand.scala
println(floor(random * 10).toInt)
More than 5 years have passed since last update.
scala.mathパッケージのメソッドを使用
0~9でランダムな値を出力
10の値をnにすれば0~n-1でランダムな値を出力
println(floor(random * 10).toInt)
Register as a new user and use Qiita more conveniently