title: Set.seed() in combination with for loop
body: <p>I use the following code:</p>
  
  <pre><code>set.seed(74)
  length = 10
  W = rep(0,length)
  W[1] = 0
  for (i in 1:length){ 
  W[i+1] = W[i]+ rnorm(1)
  }`
  </code></pre>
  
  <p>with the aim to always generate the same range of W when using the seed 74. Now, I want to add another vector, called Z but keep the same W:</p>
  
  <pre><code>set.seed(74)
  length = 10
  W = rep(0,length)
  Z = rep(0,length)
  W[1] = 0
  Z[1] = 0
  for (i in 1:length){ 
  W[i+1] = W[i]+ rnorm(1)
  Z[i+1] = Z[i] + rnorm(1)
  }`
  </code></pre>
  
  <p>Now, the problem occurs that W is changing, but I want the same W as in the first code and an additional random Z. Actually, I do not get what the command set.seed() is really doing. </p>
  
  <p>I would appreciate any help.
  `</p>