title: trying to split list by percentage
body: <p>I'm trying to split a list by taking in a percentage and randomly grabbing elements out of the main list into 2 other lists.  The trainingSet is the left over list.  I'm running into a problem when i'm generating a random index to pick from.  This code works with a small list but when I work with (len(rawRatings) = 1000) it does not work.  </p>
  
  <p>error:</p>
  
  <pre><code>  File "/Applications/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 1, in &lt;module&gt;
        # Used internally for debug sandbox under external interpreter
      File "/Applications/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 29, in partitionRankings
      File "/Users/rderickson9/anaconda/lib/python2.7/random.py", line 241, in randint
  return self.randrange(a, b+1)
      File "/Users/rderickson9/anaconda/lib/python2.7/random.py", line 217, in randrange
        raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)
    ValueError: empty range for randrange() (0,0, 0)
  </code></pre>
  
  <p>raw Ratings is a list, and testPercent is a float.  </p>
  
  <p>ex.</p>
  
  <pre><code>rawRatings = [(123,432,4),(23,342,3),(23,123,5),(234,523,3),(34,23,1), (12,32,4)]
  testPercent = .2
  partitionRankings(rawRatings, testPercent)
  [(23,123,5),(234,523,3),(34,23,1),(123,432,4),(12,32,4)],[(23,342,3)]
  
  
  def partitionRankings(rawRatings, testPercent):
      testSet = []
      trainingSet = []
      howManyNumbers = int(round(testPercent*len(rawRatings)))
      declineRandom = 0
      while True:
          if declineRandom == howManyNumbers:
                      break        
          randomIndex = random.randint(0, (len(rawRatings)-1)-declineRandom)
          testSetTuple = rawRatings[randomIndex]
          del rawRatings[randomIndex]
          testSet.append(testSetTuple)
  
          declineRandom = declineRandom + 1
      trainingSet = rawRatings[:]
      return (trainingSet), (testSet)
  </code></pre>
  
  <p>I don't want to choose the same random Index.  Once, I choose one, I don't want to randomly select it again.  I don't think this is correct.  This is the part I'm having trouble with.</p>
  
  <pre><code>randomIndex = random.randint(0, (len(rawRatings)-1)-declineRandom)
  </code></pre>