Sum of Random Variables... Imagine we repeat the following loop some thousands of times:
$$
\begin{align}
& \text{array} = []\\
& \text{for n} = 1: 10 000 \\
& k = 0 \\
& \text{while unifrnd}(0,1) < 0.3 \\
& k = k + 1 \\
& \text{end} \\
& \text{if k} \neq 0 \\
& \text{array} = [\text{array,k}] \\
& \text{end} \\
\end{align}
$$
whereas "unifrnd(0,1)" means a random number drawn from the uniform distribution on the unit interval.
My question is then: What is then the value of k, which is the most often observed - except for k = 0? And is that the expectation of k?
Thanks very much

Since the events "unifrand(0,1) > 0.3" (which lead to a repetition of the same value of $k$) can come in any order and all these orders are equally likely, there is no special value of $k$ that occurs most often. 
Edit: With the code as it reads now, the value $k = 1$ will be the most frequent one, and $k$ has indeed a geometric distribution.  
