(BECAUSE OF the modulo, index will NEVER be out of range. d1 and d2 will always be in range 1-6 !! d1+d2 ALWAYS 2-12)
it's weird because, the author doesn't "like" the random function...so he implemented his own...kind of. But it's very weird because you never know which index will be set, or how many times --- but because of how rand() works, and the fact that it calls it 100 times: each item in the array should get set at least once, most of them being set lots of times.
However, because d1 will always be at least 1 (same with d2), the index will never be 0 or 1 so you're never setting the first two items.
It's not lol when [someone] doesn't read the code carefully, yet still spouts off, get's called out on it, and spouts some more.
"If you try to access a index outside the array, the program WILL crash." -- So logically, buffer-overflow exploits can't exist? **** shit.
Even if that was correct, it'd still be irrelevant :/
LOL
@OP - If you still need help, try re-asking a question, we can't really explain "why" you use a for loop. Are you trying to create a deck of cards, or dice game? why are the first 2 items never being set?? You have to define the problems/questions better
1. You could have! doing it how you posted results in, only 10 calls to Print()
- if you put it inside the 2nd for loop, that'd be 100 Print()s. -- of all the values, not just the final 12.
2. Yes, it will only print items 2-12. (it's not 100 long...you declared it a[13] !! not a[100] :/ ) -- the 100 is there to "increase randomness"