In melee games do enemies wait for their turn to attack? or do they attack randomly no matter when?

thanks for your response.