You could hook into the pre_get_posts
action hook and set the posts’ order to random only for specific categories. Here’s a basic example on how to achieve so:
function sort_posts_randomly( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
if ( is_category( 'category id, slug, or name' ) ) {
// Sort the posts randomly
$query->set( 'orderby', 'rand' );
}
}
}
add_action( 'pre_get_posts', 'sort_posts_randomly' );