Woocommerce – Show random product thumbnail from specific product category

Add a tax_query to your $args

$args = array(
    'tax_query' => array(
        array(
            'taxonomy' => 'product_cat',
            'field' => 'slug',   //possible values are term_id, name, slug or term_taxonomy_id
            'terms' => 'tshirt'  //can be single string or array of slugs, names, term_ids or taxonomy_ids
        )
    )
);

$results = get_posts( $args );

Recommended reading: