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java.util.Random;
public class Test10 {
public static void main(String[] args) {
Test10 test10 = new Test10();
ate();
java生成随机数的方法 }
public void generate(){
System.out.println();
Random random = new Random();
List<Integer> s1 = new ArrayList<>(); //用来保存被加数或者被减数
List<Integer> s2 = new ArrayList<>(); //用来保存加数或者减数
List<String> label = new ArrayList<>(); //用来存储加减号
List<String> all = new ArrayList<>(); //保存三者的组合 避免重复
while (all.size()<60){ //控制生成个数
int a = (int) (Math.random()*10+1);
int b = (int) (Math.random()*10+1);
int c =Int(2);
String d=(c==1)?"+":"-";
//如果相减小于0 则重新生成随机数
if ("-".equals(d)){
if(a<=b){
Int(a);
//使减数不能够=0
while (b==0&&a!=1){
Int(a);
}
}
}
//如果相加大于10 则重新生成随机数
// if ("+".equals(d)){
// while (a+b>10){
// a=(int) (Math.random()*10+1);
// b=(int) (Math.random()*10+1);
// }
//
// }
//判断是否添加重复
String temp = a+d+b;
if(!"1-0".equals(temp)){ //过滤掉 “1-0”
if (!ains(temp)){
s1.add(a);
s2.add(b);
label.add(d);
all.add(temp);
}
}
}
//打印结果
show(s1,s2,label);
}
public void show(List<Integer> s1,List<Integer> s2,List<String> label){
for (int i =0;i<s1.size();i++){
int (i);
int (i);
String flag = (i);
int c=("+".equals(flag))?a+b:a-b; //将结果保存在 变量c中
System.out.print((a<10?" ":"")+a+flag+b+(b<10?" ":"")+"=\t\t");
if ((i+1)%5==0){
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论