removed random generator code from defend method and made use of the randomInt method instead