random woocommerce categories are not showing when count enabled?

While researching for this I came across Categories and products in random order which had a similar but different issue but was able to derive the required information to cut the array.

I modified his $categories = array_slice( $categories, 0, 5 ); to suit my needs. Final answer was just to add an array_slice based on $cat_number

so I modified $all_categories and called it just $categories (as I will later reference $all_categories) and changed the code to following

$categories = get_categories( $args );
$_totals = count($categories);
    shuffle($categories);
$all_categories = array_slice( $categories, 0, $number_cats );