Get user active posts randomly

But i can’t pass an array to it.I have a solution for getting the post
randomly if am able to remove array elements form $user_ids by
checking with product ids.

Yes, the wc_customer_bought_product() function only accepts a single user/product ID.

But you can loop through the $user_ids array, and for each user (ID), loop through the $product_ids and then call the wc_customer_bought_product() function, like this:

$authors = array();
foreach ( $user_ids as $user_id ) {
    foreach ( $product_ids as $product_id ) {
        // User alread checked.
        if ( in_array( $user_id, $authors ) ) {
            continue;
        }

        if ( wc_customer_bought_product( '', $user_id, $product_id ) ) {
            $authors[] = $user_id;
        }
    }
}
var_dump( $authors ); // testing

Additional Note

The wc_customer_bought_product() accepts three parameters:

wc_customer_bought_product( $customer_email, $user_id, $product_id );

Where you can provide only the $customer_email or $user_id, or both.

Also, wc_customer_bought_product() returns true only for orders that are complete and not on hold, processing, etc.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)