I have sth like this:
empty=0
full=1
burn=2
myprob=0.7
if cell==burn:
return (empty or full) with probability myprob
How can i do it?
Thanks!
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.
The expression
will evaluate to
Truewith probabilitymyprob. SinceFalseandTrueinterpreted as integers are0and1, you can useto select between the two given values with the given probability. For your particular values of
emptyandfull, the first expression will basically do the same — you only need the second one ifemptyandfullaren’t0and1respectively.