[Lua] Help - Trying to make npcs when spawned generate with a random amount of health

Hello,
I am looking for some help with lua. As stated it the title I’m trying to make it where one a npc is spawned (via the npc tab) with a randomly generated amount of health.
I belive the code itself was


math.random(10000,20000)

I would also like to know the file location of where I would put the code/how to run it.
Thank You.

Usually helps to google around a bit.

Is there a way to randomize the health?



local rand = math.random( 100 ) --random integer between 1 and 100
Ent:SetHealth( rand )


Use the wiki. Pretty sure you’re smart enough to find something to use on it.

Thanks!