title: PHP display random n images from directory
body: <p>I want to display random n number of images from a folder. Currently i am using this script to display images</p>
  
  <pre><code>&lt;?php
  $dir = './images/gallery/';
  foreach(glob($dir.'*.jpg') as $file) { ?&gt;
  &lt;div class="item"&gt;&lt;img src="&lt;?php=$file;?&gt;"&gt;&lt;/div&gt;
  &lt;?php } ?&gt;
  </code></pre>
  
  <p>I want only 10 (or n number) images, that too randomly. How to do this?</p>