はじめに
前回に引き続き、Mathクラス内で使えそうなものを記事に残します!
前回よりは使わなそうだけど、もしかしたら使うなって感じ(自分基準)
max()
max(10,-8) // 10
2つの数字の最大値
min()
min(10,-8) // -8
2つの数字の最小値
pow()
5.pow(3) // 125
累乗
PI
PI // 3.141592653589793
円周率
random()
random() // 0.6071951836875007
0以上1未満の double 型の値をランダムに生成する
val range = (10..20)
range.random() // 13
範囲を指定することで、その範囲内でランダムに値を生成する
参考