I have the following numbers in an array, {0, 1, 1, 1, 2, 3} and need to randomly choose from this array until the sum of the chosen numbers equals at least 8 for the first time. For example, {2, 1, 3, 2} is acceptable, {3, 3, 3} is acceptable but something like {3, 3, 2, 1} is not acceptable because the sum equaled 8 before the '1' was chosen. This is as far as I have gotten.
In other words, you need to select random elements (with replacement) until the total value of elements you draw is greater-than or equal to 8?
Can you pick out a random element from the array? Since valid indices of your array are integers in [0, 5], let's see you try to generate a random number in that interval.
I have the following numbers in an array, {0, 1, 1, 1, 2, 3} and need to randomly choose from this array until the sum of the chosen numbers equals at least 8 for the first time. For example, {2, 1, 3, 2} is acceptable, {3, 3, 3} is acceptable but something like {3, 3, 2, 1} is not acceptable because the sum equaled 8 before the '1' was chosen. This is as far as I have gotten.
I don't quite understand your assignment. Can you give us more examples?