public Route GetRoute(int length) { List <Checkpoint> cpsToUseForRoute = new List <Checkpoint> { Homebase }; cpsToUseForRoute.AddRange(Checkpoints.Where(cp => cp.IsHomeBase == false).OrderBy(x => Guid.NewGuid()).Take(length) .ToList()); cpsToUseForRoute.Add(Homebase); double totalDistance = 0; for (var i = 0; i < cpsToUseForRoute.Count - 1; i++) { totalDistance = totalDistance + GetDistance(cpsToUseForRoute[i], cpsToUseForRoute[i + 1]); } return(new Route(cpsToUseForRoute, totalDistance)); }