How to show 5 WordPresss Random Categories?

If our wordpress blog has many categores, say 5000 thousands, we can not show them all at sidebar. For seo purpose, we have to let search egnines to spider categories or posts without any difficulth and easily spidered. We can use many methods to achieve this, we can show some random posts under a post, we also can show some random categories under a post, how to do then? Here are the code:

<?php
// display 5 random categories
$cats =”;
$categories=get_categories();
$rand_keys = array_rand($categories, 5);
foreach ($rand_keys as $key) {
$cats .= $categories[$key]->term_id .’,’;
}
wp_list_categories(‘title_li=5 Random Categories&hierarchical=0&hide_empty=0&show_count=1&include=’.$cats);
?>