title: PHP grab images in random order from folder
body: <p>I have a folder containing images and echo them to the page.<br>
  This works fine however I want them to randomly change output upon page load.<br>
  This is the part that outputs the images:</p>
  
  <pre><code>&lt;?php 
  $directory = 'somewhere/images/';
  $files = getPathsByKind($directory,'svg');
  if(!empty($files)) {
      for($i=0; $i &lt; 32; $i++){
          echo '&lt;img src="'.get_bloginfo('template_directory').'/images/'.$files[$i].'"&gt;';
      }
  }
  ?&gt;
  </code></pre>
  
  <p>So I thought I'd had to use <code>rand()</code> or <code>array_rand()</code> but both throw me errors. Which is fine but I have no idea on how to fix them. <code>rand()</code> throws me an second parameter error. (<code>max</code> and<code>min</code> value). Since this is an image there is no second parameter. <code>array_rand()</code> won't work because of the loop it isn't an <code>Array</code> anymore.</p>
  
  <p>Any idea on how to accomplish this?</p>