Hello all,

 

On the wiki, there is an example of using mod_expr to generate a random number:

 

                <!-- generate random number between 1 and 100 -->

                <action application="set" data="rand_val=${expr(randomize(&x);ceil(random(0,100,&x)))}"/>

                <action application="log" data="INFO Random value is ${rand_val}"/>

 

This works well the first time but if the same dialplan instructions are executed subsequently, the same number is produced each time.

 

Is this by design? Is there any other way to seed the random number generator so it will produce different results, as randomize() doesn't seem to be doing quite what I thought it would?

 

Many thanks,

Chris

 

Chris Young
Software Engineer
cid:image7482a0.PNG@dc00f514.4fb88205
t:  +44 118 943 9249
e:
  chris.young@enghouse.com
w:
www.enghouseinteractive.co.uk
cid:image6c1ba6.PNG@b8963a35.449174f5

Enghouse Interactive (UK) Ltd is a company registered in England and Wales. Registered number: 04230977. Registered office: Imperium, Imperial Way, Reading, Berkshire, RG2 0TD