In the arguments for get_posts
, add 'orderby' => 'rand'
. See get_posts
in Codex for a full list of available arguments.
$args = array(
'category__in' => $category_ids,
'post__not_in' => $showed_posts,
'showposts' => $SMTheme->get( 'layout', 'relatedcnt' )-$post_cnt,
'caller_get_posts' => 1,
'orderby' => 'rand'
);