Help with Variance in a script call

Hello again. I am working on a healing command that only heals the active party members. I figure that part out easily enough.


$game_party.members[0].hp += 250 + $game_actor[8].mat
$game_party.members[1].hp += 250 + $game_actor[8].mat
$game_party.members[2].hp += 250 + $game_actor[8].mat
$game_party.members[3].hp += 250 + $game_actor[8].mat


The problem I am having is that I do not understand variance very well. I get the basics of how it works, and I found an example of it:


def apply_variance(damage, variance)

amp = [damage.abs * variance / 100, 0].max.to_i

var = rand(amp + 1) + rand(amp + 1) - amp

damage >= 0 ? damage + var : damage - var

end


The problem I am experiencing is setting up a variance for the first command, and how to actually apply it. I understand how amp works, and how var keeps it going, but I am unsure how to actually set what I am looking for variance to be based off, and then how to make it call in the above example. Any help would be greatly appreciated.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-variance-in-a-script-call.59258/