Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy

You need to get_the_category() of the product post and then set category in get_posts() to that category’s $category->term_id.