标题: 随机数 [打印本页] 作者: ruili 时间: 2015-8-30 22:33 标题: 随机数 import java.util.*;
class SuiJiShu {
public static void main(String[] args) throws Exception{
/*Random r = new Random();
int number = r.nextInt(5);
int number1 = r.nextInt(10);
System.out.println(number1);
System.out.println("你选择的排数是:" + number1);*/
Scanner sc = new Scanner(System.in);
System.out.println("游戏开始了");
new Scanner(System.in).nextLine();
while (true) {
//new Scanner(System.in).nextLine();
caoZuo();
int a = sc.nextInt();
if (a == 0) {
continue;
}else {
break;
}
}
}
public static void caoZuo(){
Random r = new Random();
int number = r.nextInt(5);
int number1 = r.nextInt(10);
//System.out.println(number1);
System.out.println("你选择的排数是: " + number1);
System.out.println("你选的列数是: " + number);