Hi thanks for the help but it didn’t work for me, I had to use wpdb to query(actually subquery) database directly and get 5 random posts.
Here is the SOLUTION: Just change the numeric value after limit to any number and the the no. of posts displayed will be the equal to that number.
<?php
$querystr = "SELECT * FROM (SELECT wposts.* FROM $wpdb->posts wposts WHERE wposts.post_status = 'publish' ORDER BY rand()) as y limit 5 ";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php //setup_postdata($post); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>