title: Python Random in While Loop
body: <p>I have a Python script that basically executes within a while loop:</p>
  
  <pre class="lang-python prettyprint-override"><code>while 1:
    &lt;do stuff&gt;
  </code></pre>
  
  <p>What I'd like to do is have it perform an action at random like, once or twice ever hour or so.</p>
  
  <p>I've tried solutions like if random.random() > 5: but it just happens way too often.</p>
  
  <p>Any ideas how I can ensure it goes off once or twice an hour while not going off constantly?</p>