Assume that I have a context variable with an array, e.g., the recognized entities. In the Watson Conversation Service (WCS) it is possible to either return responses in sequence or in random. What I am looking for is to have a single response in the dialog node, but to randomly pick an array entry and return it. I know that I can use Spring Expression Language (SpEL) for advanced evaluations. This is not working and gives an error:
Here is a random entity:
<? entities[(int) (entities.size() * T(java.lang.Math).random() ].value ?>
What can be done to produce a valid integer value for array access?