Since of this writing (2023/06/27) the Random() and RandomInt() functions to do not work in bot flows (ugggh), below is the easiest way I've found to generate a random number (more than 0-59) from within a bot flow:
ToInt( Substring( ToString( GetCurrentDateTimeUtc() ), 20, 3) )
The above will generate a "pseudo-random" number from 0-999, based on the number of milliseconds in the current UTC time.
Yes this looks a bit odd... One would think one could just get the milliseconds component off of the UTC time, alas - there is no Millisecond() function (only a Second() function).
So the above gets the current UTC time (which does have milliseconds inherent), converts this to a String, such as:
2009-01-10T06:30:00.000Z
pulls off the millisecond component (ie: that between the "." and "Z" in the above example) and then returns that as an integer.
Of course if you need a different range of numbers, you can always divide the result by 1000 and multiple by the total range of numbers.
ie: if you need a random number from 0-49 (upper range is 50), you'd use:
( ToInt( Substring( ToString( GetCurrentDateTimeUtc() ), 20, 3) ) / 1000 ) * 50
Of course the resolution for this is only 1000, to get better you may wish to call the above multiple times and multiply the results together, or other contortions (an exercise left to the reader).
Not "true" random, but close enough.
Hopefully we'll get better function coverage in bot flows in a new release of Architect in the very near future (LOTS of gaps between bot flows and standard flows at the moment).
Hope this helps someone!
Brian
#ConversationalAI(Bots,AgentAssist,etc.)#DigitalChannels#Implementation#Routing(ACD/IVR)#Unsure/Other------------------------------
Brian Raynor
Principal Architect
Verizon Business Group
------------------------------