LoginSignup
5
4

More than 5 years have passed since last update.

Scalaでランダムな値を出力

Posted at

scala.mathパッケージのメソッドを使用

0~9でランダムな値を出力
10の値をnにすれば0~n-1でランダムな値を出力

rand.scala
println(floor(random * 10).toInt)
5
4
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4