To generate random numbers in a ICM script, the function random() can be used. This function generates a random value between 0 and 1.
For example you want to play music file music0 to music 9 played random as hold music in a script.
Scripting example:
To get the first digit, the function left() can be used:
left(random()*9,1)
To create the music0, music1…music9 filenames the concatenate() function can be used:
concatenate("music",left(random()*9,1))
Function information:
random()
Random value between 0 and 1
left(s, n)
Leftmost n characters of s
concatenate(s1, s2 …)
The concatenations of the arguments. The function takes up to eight arguments.
Ref. Cisco.
|