func (s *SteadyState) populateApps(resp *models.SteadyStateResponse) error { req := resp.Request resp.Apps = make([]models.App, req.NumApps) var err error totalInstances := 0 for i, _ := range resp.Apps { resp.Apps[i].Id = i resp.Apps[i].Size, err = s.AppSizeDistribution.Sample(float64(req.MeanInstancesPerApp)) if err != nil { return fmt.Errorf("sampling app size: %s", err) } totalInstances += resp.Apps[i].Size } resp.TotalInstances = totalInstances return nil }