我只是盲目地看到解决方案吗?
sampleSum = 0;
for(int x : sampleWeights)
sampleSum += x;
population = new int[sampleSum];
int z = 0;
for(int i = 0; i < nsamples; i++)
for(int j = 0; j < sampleWeights[i]; j++)
{
population[z] = i;
z++;
}
任何帮助表示赞赏!谢谢!