liupeng 3 年之前
父节点
当前提交
ed763b3638
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      code/sapparent/sapservice/src/main/java/org/fouram/core/util/PlusQuiz.java

+ 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);
+	}
 }