0

Hello All

Tell me who is correct I or my friend

```
void main()
{
int GuessMe[4]={100, 50, 200, 20};
int Taker=random(2)+2;
for(int Chance=0;Chance<Taker;Chance++)
cout<<GuessMe[Chance]<<"#";
}
```

I am testing random() in Turbo C++ 3.5

By this code I am always getting answer 100#50# whenever I am executing this code.

My argument is random() always returning 0 from 0 & 1 so 0+2 is 2

but My friend challanged me with his logic

int Taker = random(2) + 2;

random(2) returns either 0 or 1

Hence, Taker is either (2+0=2) or (2+1=3)

IF taker is 3, then as

for(int Chance=0; Chance<Taker; Chance++), Chance can go from {0,1,2}!!

Hence, the output can be 100#50#200#

My question is if my friend's logic is correct then why random() is not returning 2?