title: Random Wordpress posts outside of the main loop without duplicate posts. How?
body: <p>Well I can't figure this one out...</p>
  
  <p>I have this Wordpress I use as a photo gallery blog.</p>
  
  <p>I have a basic setup using the main default loop for posts.</p>
  
  <p>Like this:</p>
  
  <pre><code>&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
  
  //the post
  
  &lt;?php endwhile; ?&gt;
  
  &lt;b&gt;Not Found&lt;/b&gt;
  
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>In the sidebar and where ever, I want to appear random posts.</p>
  
  <p>I've managed to do that. With this:</p>
  
  <pre><code>&lt;?php query_posts($query_string . 'showposts=1&amp;orderby=rand'); ?&gt;
  
  &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
  
  //the post
  
  &lt;?php endwhile; endif; ?&gt;
  </code></pre>
  
  <p>It looks amazing! In theory.</p>
  
  <p>There are duplicate posts all over the place. And that just looks stupid.</p>
  
  <p>I have read lots of articles but I just can't seem to get it to work :(</p>
  
  <p>Any help would be much appreciated.</p>