首页 > 代码库 > CDMA
CDMA
package toos;
import java.util.ArrayList;
import java.util.Random;
public class toos {
public ArrayList<int[]> random(){
ArrayList<int[]> list=new ArrayList<int[]>();
for(int j=0;j<5;j++){
int[] a=new int[8];
for(int i=0;i<8;i++){
int r=new Random().nextInt(10) + 1;
if(r>=6){
a[i]=0;
}
else{
a[i]=1;
}
}
boolean hege=true;
for(int p=0;p<j;p++){
if(zhengjiao(a,list.get(p))==true){
hege=false;
break;
}
break;
}
if(hege==true){
list.add(a);
System.out.print(j+".数组是");
for(int e=0;e<8;e++){
System.out.print(a[e]);
}
System.out.println();
}
else{
j--;
}
}
return list;
}
public boolean zhengjiao(int[] a,int[] b){
boolean result=true;
int sum=0;
for(int i=0;i<8;i++){
sum=+(a[i]*b[i]);
}
if(sum==0){
result=true;
}
else{
result=false;
}
System.out.println(result);
return result;
}
}
CDMA