rand

  • Output field: Returns a random item from a set.
<rand>
  <i>item 1</i>  
  <i>item 2</i>
  <i>...</i>
</rand>

Parameters

Items

A set of items, each of which is a BrainXML expression enclosed with i element.

Examples

Example 1. Give different greetings

    • Hello
    • <rand>
        <i>Hi!</i>
        <i>Hi, there!</i>
        <i>Hello my friend!</i>
      </rand>
  • 1
    • Hello!
    • Hi, there!
  • 2
    • Hello!
    • Hi!

Notes

  • The items are returned randomly, instead of their order in item list.
  • The rand element just returns a random item. It doesn't guarantee the robot to give two messages in responding to two user messages.