on line 73 you subtracted (the projection onto v_k) times v_i, when it should have been times v_k
When beta[i] is lower than the tolerance, a new random vector that is orthogonal to the previous vs should be made the next v, not an unnormalised version of the linearly dependent one.
I discovered two bugs in the algorithm.
Cheers