Help creating a formula that uses RNG for a slot machine attack item

So basically what I want to do is generate a random number 1 - 50, multiply that number by 100 and the result is how much damage all the enemies take. This will result in a damage amount anywhere from 100 to 5000 in increments of 100.

I heard that you can program randomness in the damage formula but I have never done so and I do not know how to do so.


Since this is damage to all enemies, doing a common event to generate the number and have the skill call the common event will not work because common events cannot do damage formulas. Plus, I want a variation of 5% in there so I need to do this with the damage formula.

How would I go about doing this?
Your damage formula simply needs to be rand(50) * 100
Your damage formula simply needs to be rand(50) * 100
won't it be rand(51), as rand(x) gives a number between 0 and x-1?
won't it be rand(51), as rand(x) gives a number between 0 and x-1?
If we want to avoid 0 for rand then it must be
(rand(49) + 1) * 100
If we want to avoid 0 for rand then it must be
(rand(49) + 1) * 100

Actually, it SHOULD be the following:

Ruby:
(rand(50) + 1) * 100

Or else the end result would never be 50 at all.

And for the OP, I wanna tell you that it wouldn't be a bad idea to say thanks to all who have posted here for taking the time to post stuff here.
I KNEW that's what I wanted to say. 6am is way too early for me to be looking at forums 😀

rand(50) will give you a result between 0 and 49.
rand(50) + 1 will give you a result between 1 and 50.
Actually, it SHOULD be the following:

Ruby:
(rand(50) + 1) * 100

Or else the end result would never be 50 at all.

And for the OP, I wanna tell you that it wouldn't be a bad idea to say thanks to all who have posted here for taking the time to post stuff here.
Sorry. I have been inactive lately. There are three topics I got replies to that I have not even checked yet. Also, I want to make sure it works before saying thank you. I am also behind in testing phase because I am full of ideas right now so I have been developing story. Just went deep yesterday.


Edit:

@kyonides

The formula works! Thanks

Original thread: https://forums.rpgmakerweb.com/threads/help-creating-a-formula-that-uses-rng-for-a-slot-machine-attack-item.158230/