Refactor generateRandomNumberOfNeighbour()