<h2>Random Posts</h2>
<ul>
    <?php $posts = get_posts('orderby=rand&numberposts=5'); foreach($posts as $post) { ?>
        <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php } ?>
</ul>