I'm focusing on project and I've been attempting to grab random posts together with publish pictures, but my code is simply not working generate an income thought it might. Every time I run this code, I begin to see the same content of posts (however the thumbnail images will vary.) Help me in sorting this problem.

  <ul>
     <?php $posts = get_posts('orderby=rand&numberposts=5'); foreach($posts as $post) : ?>
     <li>
        <div class="thumb-img">
           <?php if ( has_post_thumbnail()) : ?>
              <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
                 <?php the_post_thumbnail(array(165,112)); ?>
              </a>
        </div>
        <div class="post-text">
       <?php //the_excerpt(); ?> 
           <?php global $more; $more = 0; the_content('<span class="more">more</span>'); ?>
           <?php endif; ?>
        </div>
     </li>
     <?php endforeach; ?>
  </ul>

What by trying simplifying your code such as this, first:

<ul>
<?php 
$posts = get_posts('orderby=rand&numberposts=5');
foreach($posts as $post) :
?>
<li>
   <?php if (has_post_thumbnail()) : ?>
   <div class="thumb-img">
       <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
       <?php the_post_thumbnail(array(165,112)); ?>
       </a>
   </div>
   <?php endif; ?>
   <div class="post-text">
       <?php the_excerpt(); ?>
   </div>
</li>
<?php endforeach; ?>
</ul>

Does which help whatsoever?