Home > Back-end >  c
c

Time:09-21

Ask good intention person to help, when I perform the following procedure, the generated random Numbers instead of 46 has been generated, please everyone a great god show exactly the wrong what?

Void Logistics: : generate (void)
{
Int m=46;
Int Chromosome1 [45].//temporary storage generated chromosome
Srand (time (NULL));//use the current time as seed for the random generator
for(int i=0; I<45. I++)
{
Int uniform_random_variable=rand ();
//cout<& lt;" Generate a random number: "& lt; Chromosome1 [I]=uniform_random_variable % m;
Cout. Width (3);
Cout}

Void main ()
{
Double demand2 [46]={0,2.8, 3.5, 3.3, 3.2, 2.6, 2.8, 3.6, 3.1, 2.9, 3.6, 2.2, 2.3, 3.8, 1.7, 1.1,
2.2, 2.6, 2.3, 3.8, 2.5, 2.2, 3.4, 3.0, 2.8, 2.9, 3.7, 3.5, 2.5, 3.6, 2.7, 2.1, 3.4, 2.4, 2.1,
3.2, 2.9, 3.8, 3.9, 3.1, 2.1, 2.8, 3.8, 3.6, 2.3, 2.4};
Int x2 [46]={0206253224268239272181228203238229185274197232185235,
237238330223243247242225211207295258258243210325235318195,
212232214203215243251288266};
Int y2 [46]={0196151213183224181233227200233217218183201146191211,
282235165235225237223212214172143222246243173157234160200,
219231175201221216223275259};
Logistics Logistics (6,25,50,2,0.8, 0.0001);
The Customer the Customer (demand2, x2, y2);
Logistics logistics1 (the customer);
Logistics. The generate ();

}