Variable with random numbers as a script

Good day!
As far as I know, you can't put a variable in the movement route. In that case, can I put it there as a script? If yes, how can I convert this screenshot into a script? : )
234345434356.png

$gameVariables.setValue(16, -10 + Math.randomInt(16))
RMMV's Math.randomInt(n) generates a random number from 0 to n-1 (inclusive). So Math.randomInt(16) returns a random number in the range 0~15.

$gameVariables.setValue(16, -10 + Math.randomInt(16))

RMMV's Math.randomInt(n) generates a random number from 0 to n-1 (inclusive). So Math.randomInt(16) returns a random number in the range 0~15.
What if I wanted a random number from 155-157 AND 171-174 but only want 1 return value from those seven possibilities?
What if I wanted a random number from 155-157 AND 171-174 but only want 1 return value from those seven possibilities?

var list = [155, 156, 157, 171, 172, 173, 174]
$gameVariables.setValue(var id, list[Math.randomInt(7)])
Ah, I just answered this on your thread here, pretty much the same as what AmVa suggested:

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/variable-with-random-numbers-as-a-script.154651/