I would like to simulate the probability of producing good products and also defects with let's say 80% probability.
I've seen that it's possible to generate numbers and see if they are equal to the probability I'm looking for. But I'm not that good at Java programming and AnyLogic is a bit different than Java in that I can't call libraries etc I think.
I have tried this but it doesn't work. Only parts_count
keeps getting incremented but not parts_defect
which stays at 0 during the whole simulation. What am I doing wrong? Thanks
double probability = normal();if ( -2<probability || probability<2){ parts_count += 1;} else if ( -2>probability || probability>2){ parts_defect +=1;}
PS. normal() generates a normal distribution with sigma = 1 and mean = 0. I know 2*sigma is not equal to 80% I was just trying out for the sake of the example.