title: Generating random numbers without repeats
body: <p>I'm building a website that will randomly display a yelp listing each time the page is refreshed. The yelp search api returns 20 listings in an array. Right now, I am using PHP's function rand(0,19) to generate a random listing every time the page is refreshed ( $businesses[rand(0,19)] ).</p>
  
  <p>Can someone refer me to a smarter method to randomize? I want to show all 20 listings once before any of them are repeated. What is the  preferred method to handle this problem?</p>
  
  <p>the below answer doesn't work because the numbers are recreated every time I refresh the page. I'm guessing I need to store which numbers I've used already?</p>
  
  <pre><code>$numbers = range(0, 19);
  
  shuffle($numbers);
  </code></pre>
  
  <hr>
  
  <pre><code>// Handle Yelp response data
  $response = json_decode($data);
  $RANDOM = rand(1,19);
  $business = $response-&gt;businesses;
  
  echo "&lt;img border=0 src='".$business[$RANDOM]-&gt;image_url."'&gt;&lt;br/&gt;";
  echo $business[$RANDOM]-&gt;name."&lt;br/&gt;";
  echo "&lt;img border=0 src='".$business[$RANDOM]-&gt;rating_img_url_large."'&gt;&lt;br/&gt;";
  
  ?&gt;
  </code></pre>