Try use math.random, like:
function onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
local myEvent = 25335 -- event points storage
local percent = creature:getMaxHealth() * 0.02
for k, v in pairs(monsterSystem) do
if v.name:lower() ==...