What does it mean to say “do this with probability p”? Does it mean that if p > 0.5, we will do “this”?
How would you write the code or algorithm for doing something with the probability p?
Thank you,
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, it’s more or less: choose a random number between 0 and 1 then, if that’s is less than or equal to
p, do something.For example, say
pis equal to 0.75 (do something with a probability of 75%). When selecting random numbers in the range 0 through 1, about 75% of them will be 0.75 or less.In terms of programming, you could code this up as (pseudo-code, obviously):