stat determined varying damage

how would you use a stat to determine varying damage in a damage formula? Id like to make an intelegence stat and make that one of its functions, it being the minumum


20 would be the highest since thats the highest charecters stats go in my game


edit: nevermind. i found the awnser, it was in another thread where someone was asking how to apply a state to a certain charecter 5% of the time from a specific attack. the knowlage, not the specific awnser


rand (20) > a.stat 


stat being whichever stat i want to be the stat

Original thread: https://forums.rpgmakerweb.com/threads/stat-determined-varying-damage.73671/