title: pick from random list and decrement result for next pick
body: <p>What i'm trying to accomplish is to pick randomly from a list of people in column A, however once they have been picked, they should be removed from the list. The idea is to create a roster which will randomly pick someone every week - but remove the person once they are picked (and recreate the array once its 0)</p>
  
  <pre><code>Example
  
  Paul
  David
  John
  Matt
  </code></pre>
  
  <p>by running the random(A1:A4) , I may get David as my pick, however the next time I run the function the Array is built again from A1:A4 - therefore David isnt removed.</p>
  
  <p>I tried adding a second column to track picks, and then delete them from an array, however I was only able to remove 1 value from the array without retaining what was done</p>
  
  <pre><code>Example
  
  List of Users      Tracking        Result (print all values)
  Paul                               John   David,Paul,Matt
  David              John            David  Paul,Matt
  John               David           Matt   Paul,John
  Matt               Matt            David  Paul,John
  </code></pre>
  
  <p>Although the Result isnt all values, i included all values to show the logical issue I am having. In the tracking column, I left the first blank so that the value in the tracking field is the value I get from result(result only gets 1 value normally)..so B2 = C1</p>
  
  <p>Can I get some pointers on how to do this. (google-apps-script)</p>
  
  <p>For those asking for the code here it is</p>
  
  <pre><code>function random(a,b) {
    var listPeople = new Array();
    for (var i = 0; i &lt; a.length; i++) {
      var row = a[i];
      for (var j = 0; j &lt; row.length; j++) {
        var value = row[j];
        if (value) {
          listPeople.push(value); 
        }
      }
    }
  //deleting someone
    var trackPeople = listPeople.slice(0);
    for (var i = 0; i &lt; trackPeople.length; i++) {
      if (trackPeople[i] == b) {
        trackPeople.splice(i,1);
      }
    } 
  // Returning a persons name
    if (trackPeople.length &gt; 0) {
      var pick = Math.floor(Math.random() * trackPeople.length);
      return trackPeople[pick];
    }
  }
  </code></pre>