Well you could imagine your code like this:
You roll 3 dice, one after the other (that’s your 3 Random.value accesses).
Only when your first die roll comes up with a 4,5 or 6, you set the current element to “1”
Now you roll your second die. Only when the second die comes out as a 6, you set / overwrite the current element to / with “2”
Now you roll your third and last die. When you roll a 3,4,5 or 6 is that third die, you set / overwrite the current element to / with “3”.
Just imagine your first die rolls a “2”. That means, the first if statement is not true since only values 4,5 or 6 make the if statement true, so it does nothing. Next, imagine your second die rolls a “5”. The second if statement will also be skipped since only a “6” will make the condition true. So the second if statement also does nothing. Finally imagine your third die rolls a “1” which is not on the positive outcomes for the third if statement. So it also does nothing. As a result, if such a combination comes up, none of the if statements will be true, so none will set the element and the element keeps its original value which is “0”.
Your overall approach is flawed. Rolling 3 random number will completely mess up your probabilities. Especially since they are not in any ascending or descending order. Also you don’t have an else-if chain, so later events can overwrite the ones earlier. You will actually get probabilities like this:
0 - 12%
1 - 12%
2 - 6%
3 - 70%
You usually want to roll a single random number and essentially chop up the total range between 0 and 1 and assign each section to a certain outcome. You want to have 3 different outcomes, so there will be 3 sections so two “splitters”. So for example, if you want to get a “1” 50% of the time and a “2” 20% of the time, you get automatically a 3 30% of the time since the probabilities always have to add up to 100%. What you would usually do is something like this
float rand = Random.value;
if (rand < 0.5f)
rando[r]=1;
else if (rand < 0.5f + 0.2f) // Acutally rand < 0.7f
rando[r]=2;
else
rando[r]=3;
float rand = Random.value;
if (rand < 0.5f)
rando[r]=1;
else if (rand < 0.5f + 0.2f) // Acutally rand < 0.7f
rando[r]=2;
else
rando[r]=3;
So you get those 3 ranges:
0 - 0.5 50% => 1
0.5 - 0.7 20% => 2
0.7 - 1.0 30% => 3
Note that the else if chain will always ever allow a single if statement to actually fire. The last one is just an else since it has to catch “all the rest”. Just like when splitting a bill in a restaurant. Each person pays his part, but the last one has to pay all what’s left over on the bill. Usually, if everyone else has paid for their stuff, the remaining items is what the last one had. In the end the whole bill has to be paid.