X-Originating-IP: [200.42.4.138] From: "Norberto Alfredo Bensa" To: "DJGPP" References: <92ldqa$300$1 AT news DOT inet DOT tele DOT dk> Subject: Re: small problem with namegenerator. Date: Sat, 30 Dec 2000 19:10:57 -0300 Organization: nBens@ Computers X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: X-OriginalArrivalTime: 30 Dec 2000 22:13:15.0618 (UTC) FILETIME=[B4E4DC20:01C072AD] Reply-To: djgpp AT delorie DOT com From: "neohashi" > Hi to all, > > I am trying to make a random name generator, but thou they are random, all > 2000 names ends up the same... what is wrong here?? > > [snip] > > char *n1,*n2,*n3,finalname[11]; > > for(n=0;n<2000;n++) > { > ran = (random()%10); > > if(ran <= 5) > n2 = "ka"; > else > n2 = "cona"; > bug, should be: if (ran <= 5) n1="ka"; else n1 = "cona"; Anyway, you'll only get 8 diffrent names... 2^3 = 8... Regards, Norberto