# Thread: [SOLVED] Simple Probability Question (Programming)

1. ## [SOLVED] Simple Probability Question (Programming)

Hi guys. So I have a simple probability question that involves a little pseudo-code. Just need some advice, not answers so I am not posting my whole question from my homework, just the part that is giving me confusion.

You have a procedure that returns either 0 or 1. It returns 0 with some probability p and returns 1 with probability 1 - p, where 0 < p < 1. You do not know what p is.

What does it mean when it says it returns 0 with some probability p, and 1 with probability 1-p?

Since p is between 0 and 1, say p is for example, .75. Then when I run that subroutine, does it return 0 or 1? 1-0.75 is 0.25, but what, does it round down?

2. Originally Posted by mander
Hi guys. So I have a simple probability question that involves a little pseudo-code. Just need some advice, not answers so I am not posting my whole question from my homework, just the part that is giving me confusion.

You have a procedure that returns either 0 or 1. It returns 0 with some probability p and returns 1 with probability 1 - p, where 0 < p < 1. You do not know what p is.

What does it mean when it says it returns 0 with some probability p, and 1 with probability 1-p?

Since p is between 0 and 1, say p is for example, .75. Then when I run that subroutine, does it return 0 or 1? 1-0.75 is 0.25, but what, does it round down?
Well, if I said:

You have a coin that returns either H or T when tossed. It returns H with probability 1/3 and returns T with probability 2/3

what do you think this means? If I toss the coin, what happens?

Now read this: Binomial distribution - Wikipedia, the free encyclopedia

3. OH! I get it now. Thank you. I should be able to finish this assignment then. I just didn't understand the way they worded it... I'm not very used to probability terminology, I guess. And Thanks for the link! My prof never referred to our topic as binomial distribution or Bernoulli distribution so I didn't know how to research it further. That helps a lot.

Thanks again Mr. Fantastic