I would return the distance array here, as it is a way to write code that makes it explicit the distance is modified.