I'm using following code to generate random number in Groovy. I can run it in e.g. Groovy Web Console (https://groovyconsole.appspot.com/) and it works, however it fails when I try to run it in Mule. Here is the code I use:
log.info ">>run"
Random random = new Random()
def ranInt = random.nextInt()
def ran = Math.abs(ranInt)%200;
log.info ">>sleep counter:"+flowVars.counter+" ran: "+ran
sleep(ran)
And here is an exception that gets thrown:
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script26.groovy: 9: expecting EOF, found '?' @ line 9, column 25. def ran = Math.abs(?400)?%20?0; ^
1 error