How to generate a random number in a formula? (solved)

my question is the title 😉


Thanks!
Math.randomInt(6)




will generate a random integer between 0 and 5.


Math.randomInt(6) + 1




will generate a random integer between 1 and 6.
will generate a random integer between 0 and 5.



Math.randomInt(6) + 1




will generate a random integer between 1 and 6.



Can this snippet be integrated into an event page? Or does it require being integrated into a plugin?
Can this snippet be integrated into an event page? Or does it require being integrated into a plugin?

i believe this is more for damage formulas and such, event page has its own random function within variables
Can this snippet be integrated into an event page? Or does it require being integrated into a plugin?



What do you mean?
What do you mean?



When you nod your head yes, but you wanna say no, what do you mean?~


Jokes aside, i think he meant how to use it as event? *shrugs* I thought there is already an option in the editor to set a variable and assign it to a number.


@Lnik3500 What are you trying to do actually in the event? There is already a default option in the editor, or if you wanna use Javascript, you can find at the bottom of one of the pages in the event editor.
When you nod your head yes, but you wanna say no, what do you mean?~


Jokes aside, i think he meant how to use it as event? *shrugs* I thought there is already an option in the editor to set a variable and assign it to a number.


@Lnik3500 What are you trying to do actually in the event? There is already a default option in the editor, or if you wanna use Javascript, you can find at the bottom of one of the pages in the event editor.

it is for a damage formula 😉


Thank you Tsukihime!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-generate-a-random-number-in-a-formula-solved.58995/