2019年3月28日木曜日

Math.random()

 Math.random()

指定范围内乱数。

import java.util.*;
class random {
public static void main(String[] args) {
double temp = Math.random();
System.out.println(temp);
System.out.println(temp * (500 - 600));
System.out.println((int)(temp * (500 - 600) + 600));
System.out.println(Math.random() * (5 - 10) + 10);
}
}

0 件のコメント: