How to use a variable for RNG

So uhh i basically want to do this on rpg maker MV
1707256953387.png
Script =>

JavaScript:
$gameVariables.setValue(x, Math.randomInt($gameVariables.value(y) + 1)

Where x is the ID of the variable you want to set to the random number, and y is the ID of the variable containing the non-inclusive upper bound of the randomness.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-a-variable-for-rng.165519/