--- flickr_block.module	2007-12-18 04:27:30.000000000 -0800
+++ flickr_block.module	2007-12-18 04:27:30.000000000 -0800
@@ -180,13 +180,21 @@ function _flickr_block_random($nsid, $sh
     // we shouldn't try to return more than the total number of photos
     $to = min($show_n, $photos['total']);
     $output = '';
+    $all_photos_arr = array();
     for ($i = 0; $i < $to; $i++) {
       sleep(0.125);
       // request a random page
       $photos = flickr_photos_search($nsid, rand(1, $page_count), array('per_page' => 500));
       // then select a random photo
       $index = rand(0, count($photos['photo']) - 1);
-      $output .= theme('flickr_block_photo', $photos['photo'][$index], $size);
+      if(in_array($index, $all_photos_arr)) {
+        // Not to select a photo if already selected
+        $i--;
+      }
+      else {
+        $all_photos_arr[] = $index;
+        $output .= theme('flickr_block_photo', $photos['photo'][$index], $size);
+      }
     }
   }
   return $output;
