title: R Using Sample to Create Column of Matrix with Random numbers
body: <p>With the help of people on this site I have a matrix <code>y</code> that looks similar to this (but much more simplified).  </p>
  
  <pre><code>1,3
  1,3
  1,3
  7,1
  8,2
  8,2
  </code></pre>
  
  <p>I have created a third column that generates random numbers (without replacement for each of the repeating chunks using this code <code>j=cbind(y,sample(1:99999,y[,2],replace=FALSE))</code>. </p>
  
  <p>Matrix <code>j</code> looks like this:</p>
  
  <pre><code>1,3,4520
  1,3,7980
  1,3,950
  7,1,2
  8,3,4520
  8,3,7980
  8,3,950
  </code></pre>
  
  <p>How do I obtain truly random numbers for my third column such that for each of the repeating rows i.e. 3,then 1, then 2 I get a random number that is not replicated within that repeating part (<code>replace = FALSE</code>)?</p>