I have a probability problem but maths is not my strongest field. I usually use online calculators but I have a specific problem. I have three variables in my code which randomly generate a number between 0 to 255.
a = 0 to 255
b = 0 to 255
c = 0 to 255
All three variables are generated at the same time, I am trying to work out the chance of either one of them being 0, or two of the variables being 0.
I have the probability of one of these variables being 0 as a single event = 0.39%
Then based on this:
Chance of all 3 variables being 0 = 0.0000059%
Chance of at least one variable out of three being 0 = 1.17%
Chance of at least two variables out of three being 0 = ????
Any help would be appreciated, thanks.
The probability of (exactly) two of them being $0$ is $$\binom 3 2 \left(\frac 1 {256}\right)^2 \left(\frac {255} {256}\right),$$ while the probability of all of them being $0$ is $$\left(\frac 1 {256}\right)^3.$$
Now, observe that the result you are looking for is simply the sum of these two probabilities.
Also, as mentioned in a comment, your problem is closely related to the binomial distribution.