Campbell Ritchie wrote:Well, have you worked out what the value of the array index is? That shouldn't be too difficult since there appears to be only one place you use an index.
Liutauras Vilda wrote:If you'd be using better chosen variable names, would find it in a seconds.
How many elements your array holds?
Liutauras Vilda wrote: . . . If you were more patient, . . .
Campbell Ritchie wrote:
Liutauras Vilda wrote: . . . If you were more patient, . . .
Liutauras Vilda wrote:You're using pseudo random generated number.
Lets assume you got generated 13.
What's been told in this forum - "there are no silly questions". It is a learning process I am learning too!Dhananjay Deshmukh wrote:ok ok i got it, it was a silly question, it clicked me why
not always, but only, when generated number is greater than 12. It is difficult to predict how often it would happen, but range could be between 0 and infinity-1 (i think).it will always show 0
No, you didn't. It means you would expect to run the program 2³² times and even then there is a significant risk of getting the Exception every time.Dhananjay Deshmukh wrote:
Yesterday, I wrote:
Liutauras Vilda wrote: . . . If you were more patient, . . .
ok ok i got it, . . .
Liutauras Vilda wrote:but range could be between 0 and infinity-1
Liutauras Vilda wrote:
Liutauras Vilda wrote:but range could be between 0 and infinity-1
What a silly thing I just said here. Dhananjay, ignore that bolded part.
There is the limit for sure, Campbell Ritchie just prompted to me - thank you Campbell.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |