How to automatically and randomly reorder custom post type?

Or the pre_get_posts approach for the CPT archive…. which is more efficient since you don’t query twice.

function wpa104766_randomize_cpt( $query ) {
    if ( is_admin() || ! $query->is_main_query() )
        return;

    if ( is_post_type_archive( 'movie' ) ) {
        // Display custom post type called 'movie' in random order
        set_query_var( 'orderby', 'rand' );
        return;
    }
}
add_action( 'pre_get_posts', 'wpa104766_randomize_cpt' );