If we want to randomly select a boolean value, we can use the world’s ‘choose true’ function (called boolean.next in some versions of Alice).  For example, if we have a boolean variable, ‘ask’, which is true when we want an object to ask a question.  Let’s assume we want the object to ask a question with a probability of 75%, then we could do the following:

 

1)      set the value of ask using the choose true function and selecting 50% for ‘probability of true’.  The Alice instruction would look something like:

o       ask set value to  choose true .5 (50%) of the time

o        

2)      Use ask as the condition in an if-else statement

 

As an example, see this Demo and Code.