I am posting an working random-posts-from-from-custom-taxonomy here.. I used it in my old theme and it is 100% functional. just clear the mess… sorry for messy snippet.
<?php
// get the custom post type's taxonomy terms
$custom_taxterms = wp_get_object_terms( $post->ID, 'genre', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'albums',
'post_status' => 'publish',
'posts_per_page' => 13, // you may edit this number
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => 'genre',
'field' => 'id',
'terms' => $custom_taxterms
)
),
'post__not_in' => array ($post->ID),
);
$related_items = new WP_Query( $args );
// loop over query
if ($related_items->have_posts()) :
echo '<div class="widget"><h4 class="related_head">Also Check Out</h4><ul class="related section group">';
while ( $related_items->have_posts() ) : $related_items->the_post();
?>
<li class="col2 x12"><div class="img"><a href="<?php the_permalink(); ?>"><?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( 'small_thumb' );
}
else { ?> <img width="60" src="/mp3/albumcover_min.jpg" alt="<?php the_title(); ?> Album thumb image" />
<?php }
?></a></div><div class="related_content"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><br/>
<?php echo get_post_meta($post->ID, 'wpcf-total-songs', true); ?> Songs</div></li>
<?php
endwhile;
echo '</ul></div>';
endif;
// Reset Post Data
wp_reset_postdata();
?>