How to produce a different random number

I just create a script as written as below
$(eval var r=Math.random();r+" and "+r;)
expect result : 83 and 32
actual result shows : 13 and 13

My quetion is how to produce 2 different random number in a line. because as showing in the script, it only run the Math.random() one time only.

You would need to run Math.random() twice.

$(eval `${Math.random()} and ${Math.random()}`)

I had tried this way, but I would like to know if there have any alternative ways?

There’s not actually. You would have to run it twice like I have to get two different numbers.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.