Add Random Posts in a Page

get_posts() can be used to collect and display any number of random posts you want. Here’s an example that lists the titles (as links) of four random posts:

<ul><li><h2>Some Random Posts</h2>
<ul>
<?php
$rand_posts = get_posts(‘numberposts=4&orderby=RAND()’);
foreach( $rand_posts as $post ) :
?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</li></ul>