Working with Imacros javascript, need random varia

2019-09-20 17:09发布

问题:

I am working with Imacros, and using this to get random values from 0 to 5, for Var1. Is there any way i can block out "4" out of the pool, as "4" is not needed.

SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*5 + 0); randomNumber;")

Alternatively, is there any way i can define Var1, to be random from values: 0,1,2,3,5 ?

回答1:

How about this?

SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*4); randomNumber==4?5:randomNumber;")