I am currently going through the "Causal Inference with Infer.NET" article by John Winn.

https://blogs.msdn.microsoft.com/infernet_team_blog/2012/01/27/causal-inference-with-infer-net/

While I understand the reasoning behind how the model is constructed and why it works, I just can't get around the workings of this line of code:

B[N] = A[N] != Variable.Bernoulli(q);

The double value of q governs how noisy copy of A the B will be. The smaller value q, the more B is similar to A. If the value is large, say 0.4, the more noisy it will be.

My question is: I don't understand by looking at this line of code how varying the value of q makes this happen? In my understanding, the condition is checked and the outcome is assigned to B. To me, changing q from small value to larger value, does not
translate in that behavior. I am missing something? Are there some examples that might help to understand this better?

The A and B are arrays of Variable<bool> type Variable.Bernoulli(). The both arrays are of the same length.

Thanks