WP_Query not resetting after wp_reset_postdata

If order by RAND is disabled at server level, you can try doing the rand by hand by running the query and get the ids first, then running a new query from the result including x random post ids:

$get_all_args = array(
    'fields'  => 'ids',
    'posts_per_page' => 99,
    'order'    => 'DESC',
    'orderby' =>  'modified',
    'tax_query' => array(
        array(
            'taxonomy' => 'Count',
            'field' => 'slug',
            'terms' => $f_r,
        )
    )    
);


$query_all = new WP_Query( $get_all_args );

// additional code and checks
// ...
// ...

wp_reset_postdata();

$args = array(
    'post__in ' => array_rand(array_flip( $query_all ), 4)
);
$query = new WP_Query( $get_all_args );

// additional code and checks
// ...
// ...

wp_reset_postdata();

You will get 4 random posts from the latest modified posts, notice I’m not using 'posts_per_page'=> -1 since this is not a good practice and can harm your site speed