title: How to pythonically select a random index from a 2D list such that the corresponding element matches a value?
body: <p>I have a 2D list of booleans. I want to select a random index from the the list where the value is <code>False</code>. For example, given the following list:</p>
  
  <pre><code>[[True, False, False],
   [True, True, True],
   [False, True, True]]
  </code></pre>
  
  <p>The valid choices would be: <code>[0, 1]</code>, <code>[0, 2]</code>, and <code>[2, 0]</code>.</p>
  
  <p>I could keep a list of valid indices and then use <code>random.choice</code> to select from it, but it seems unpythonic to keep a variable and update it every time the underlying list changes for only this one purpose.</p>
  
  <p>Bonus points if your answer runs quickly. </p>