Math.random regarding paintings

I'm confused about how tables (in Javascript) work in tandem with functions like math.random. Here is an example of the code I would use...

Math.Random is not so random

I'm doing a basic game with popup boxes. My problem is that if you look at the  goblinAttack  function, it repeats until the goblin is d...