How to set a variable to 1 ? \V[x] - (rand($game_variables[x] +1

In VX Ace the way I did this was set the Operand to Script: rand($game_variables[1] +1

Does anyone know how to rewrite this script for MV?  I'm getting a syntax error.
Do you want a random number based on a value in a variable ? This should do the trick :

Code:
Math.random($gameVariables.value(1)+1);
Edit : I don't know what the rand(X) function of VXAce did, but if it was giving a value between 0 and X, you should do:

Code:
Math.random()*($gameVariables.value(1)+1);
And if you want integers only :

Code:
Math.floor(Math.random()*($gameVariables.value(1)+1));
Do you want a random number based on a value in a variable ? This should do the trick :

Math.random($gameVariables.value(1)+1);Edit : I don't know what the rand(X) function of VXAce did, but if it was giving a value between 0 and X, you should do:

Code:
Math.random()*($gameVariables.value(1)+1);
And if you want integers only :

Code:
Math.floor(Math.random()*($gameVariables.value(1)+1));
Thank you Schlangan.

What I was wanting to do was set up a random number between 1 and a variable.  The default random operand doesn't allow me to use variables - just straight numbers like 1 ? 2.  I was wanting to set a variable to random: 1 ? \V[x].  So it was giving me some problems.

Math.random()*($gameVariables.value(1)+1); looks to be working for what I wanted to do.  I do appreciate the help.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-set-a-variable-to-1-v-x-rand-game_variables-x-1.50408/