I've got some code which creates a nice link to a random post - any way to amend it so that on a category page it selects a post from the current category?
thanks,
<?php
$randomPost = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 1");
echo '<a href="'.$randomPost.'">Random Post</a>';
?>