Adding new functions to use in plugin formulas

I'm not sure if this goes here or in Learning Javascript, but

Right now I'm using plugins (mostly Yanfly, some others) to customize a lot of my formulas. As of now, the formulas are pretty long and cluttered, so I want to add some basic functions to clean them up. Unfortunately I've tried two different plugin templates (this and this) and spoken to some experienced coders, but I haven't been able to get any of them to work.

I have an RNG function that I'd like to be able to use in my damage formula through YEP_DamageCore.
JavaScript:
function spread(a) {
    return Math.floor(Math.random() * (a + 1))
}

I then put this in the notebox for the skill I'm using, just as a test.

JavaScript:
<damage formula>
value = spread(10);
</damage formula>

Unfortunately while DoveUtil2 does show up in the Sources in the console, no matter what I do the attack does 0 damage and the console just says something like this. I don't know how to "define" DoveUtil and so far no one's been able to tell me.

Some of my functions are more complex, using information from other plugins (like ICFSoft_ParamsCore and YEP_RowFormation) but for now I'm just going to focus on the simplest. Here's the complete current version of my plugin so far: and, just in case it helps, the list of cleaned-up formulas with the functions they need to reference: .
Okay, a coder friend finally cracked it. For anyone else trying to do the same thing: it came down to taking out most of the plugin template stuff, since this really isn't a full plugin. It's literally as simple as putting in the plugin header and then the functions.

Basically this:

Original thread: https://forums.rpgmakerweb.com/threads/adding-new-functions-to-use-in-plugin-formulas.121426/