liupeng 3 лет назад
Родитель
Сommit
ed763b3638

+ 8 - 4
code/sapparent/sapservice/src/main/java/org/fouram/core/util/PlusQuiz.java

@@ -6,13 +6,13 @@ import java.util.Random;
 import com.google.common.collect.Lists;
 
 public class PlusQuiz {
-
-	public static void main(String[] args) {
+	
+	private static void print(int limit) {
 		List<String> list = Lists.newArrayList("+", "-");
 		for(int j = 0; j < 210; j ++) {
 			for(int i = 0; i < 3; i ++) {
-				int number1 = (int) (Math.random() * 10);
-				int number2 = (int) (Math.random() * 10);
+				int number1 = (int) (Math.random() * limit);
+				int number2 = (int) (Math.random() * limit);
 				String randomElement = null;
 				if (number1 < number2) {
 					randomElement = "+";
@@ -25,4 +25,8 @@ public class PlusQuiz {
 			System.out.println();
 		}
 	}
+
+	public static void main(String[] args) {
+		print(10);
+	}
 }