title: How to generate a random ID that is not already in a list in Python?
body: <p>I am trying to make a list of cues for a movie playback system.</p>
  
  <p>Every time a cue is created I want to add an <code>id</code> to the cue object.</p>
  
  <p>(Which looks something like)</p>
  
  <pre><code>{
      "name": "Cue One",
      "length": 5000,
      "id": xxx
  }
  </code></pre>
  
  <p>Each cue object will get stored in a list of cues.  However, I want to know the best way to generate <code>ids</code> for each cue since they will ultimately be looked up, in the list, by ID.</p>
  
  <p>I know I could do something like (<code>max[cue.id for cues in cuelist] + 1</code>) or I could use the <code>random</code> module and check to see if the <code>randint</code> is not in the cues id, however I do not know what the most "legit" way to do this is.</p>
  
  <p>Is there some specific technique or algorithm for this sort of problem?</p>