title: Repeat process until condition is satisfied
body: <p>I have the following code:</p>
  
  <pre><code>   1. A=rnorm(100,mean=0, sd=30)
     2. B1=A+rnorm(100,mean=0,sd=10); B2=A+rnorm(100,mean=0,sd=30); B3=A+rnorm(100,mean=0,sd=50)
     3. d=data.frame(A, B1,B2,B3)
     4. c=cor(d)^2
     5. r=c[2,1]/c[4,1]
  </code></pre>
  
  <p>I would like to repate lines <code>1-4</code>. until the condition <code>1.6 &lt;=r &lt;=3.5</code> is satisfied.</p>
  
  <p>I.e. I would like to generate <code>A, B1, B2, B3</code> so that they satisfy the criteria that <code>r</code> is between the values <code>1.6</code> and <code>3.5</code> if the value of <code>r</code> falls out of that range I would like to repeat <code>1-4.</code> until it falls within the range. </p>