Following code will display a list of 5 posts selected randomly by using the MySQL RAND() function for the orderby parameter value:

 <ul><li><h2>A random selection of our Posts</h2>
 <ul>
 <?php
 $rand_posts = get_posts('numberposts=5&orderby=rand');
 foreach( $rand_posts as $post ) :
 ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
 <?php endforeach; ?>
    </ul>
 </li></ul>