-3
if(aveRP[0] == 0){}
else if(aveRP[0] > 0){
for(int i = 0 ; i < 100; i++){
double a = r.nextGaussian() * 0.3 + aveRP[0];
if (a < 0 || a > 1){}
else{ relinp.add(a);}

where aveRP is an array list of double variable type ?

1 Answers1

1

aveRP[0] == 0 This statement is checking whether the first element of array aveRP is 0 or not. If it is 0 then no code is executed. The else block again checks if it's greater than 0.

Bottomline, there are many un-necessary validations in your code. The code written in your question is equivalent to :

if(aveRP[0] > 0){
    for(int i = 0 ; i < 100; i++){
        double a = r.nextGaussian() * 0.3 + aveRP[0];
        if( !(a < 0 || a > 1) ){ relinp.add(a);}
    }
}
Raman Sahasi
  • 30,180
  • 9
  • 58
  • 71