Yanfly's Buffs and States Help

Ok so I've managed to get a state that applies an on hit effect for a basic attack, similar to league of legends, but I can't figure out how to get it to only work, lets say, 70% percent of the time.


How do you get it to generate a random number then check said random number. with lunatic mode that is.


Would really like to get this to work. thank you for any and all help. I'm new to Java but really trying to learn. 🙂  
Code:
var pctage = Math.random();
if (pctage <= 0.7) {
	//do events
}
var pctage = Math.random();
if (pctage <= 0.7) {
//do events
}

you sir, are my favorite person today. I would have never figured this out. thank you.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-buffs-and-states-help.57316/