Distance between randomly spawned objects

Exactly. So add an extra if clause that checks the enemy location.