Do you mind explaining some logic behind this code such as the value range of Math.random() and value of hpRate so I can better manipulate it for certain skills (and build up my own MV JS knowledge)?
The Math.random() is a default JavaScript function, so you'd find the documentation on it
with a Google - but it generates a value from 0 to .9 barred.
And if you're getting into JavaScript, you could do a search for the text "hpRate" in your js folder and find it in the source code, but it's pretty much what it sounds like - it returns the rate (ratio) of the HP, so it's simply hp/mhp. Thus, a value from 0 to 1.
So, mathematically, the two things correspond to exactly what you wanted - if the target has full HP, Math.random() can't get up to 1, so there's a 0% chance of it being equal.
Also, I've been hesitant asking straight up advice like this as I feel like it's a bit rude to just get people to write everything for me, is this the norm? If so I have another problem related to this I need help with
If you start going overboard you won't find people willing to "write everything" for you
😛
But yes, it's very typical for something like a short notetag to post in Plugin Support (since you can't do it with just MV alone) and ask for help with the code.