Creating random number (between 0-1) ->
A. If the random number is lower than the prob in the first row -> add 1 to Attempts and 1 to Succeeded (just for the first row) and then create another random number and move to the next row and check if is greater or lower - if is lower, add 1 to Attempts and 1 to Succeeded (just for the second row) and then create another random number and move to the next row...and so on...
B. If the random number is greater than the prob in the first row -> add 1 only to Attempts (just for the first row) and then create another random number and do the same but don't continue to the next row.
It's like creating a counter for each element in the vector, and to calculation should move to the next row only when the random number is lower than the prob.
I would write a function to do this. There is no need to predefine the Attempts and Succeeded columns but I did it to conform to your example. Also, isn't the Succeeded column always 1?
Thanks a lot for your help! Regarding succeeded - you are right, I want to create a for loop that will simulate several iterations. To do so I just need to insert for loop in the beginning of the code?
You can make another for loop or you can make the variable Success a counter and set the while loop to run until Success reaches a given value. That will be more efficient but you will have to store value of Attempts for each value of Success.