5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Scalaでランダムな値を出力

5
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?