Was able to solve this by first registering the custom query var.
https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars
And then next I used the switch
function:
global $wp_query;
switch ( $wp_query->query_vars['filter'] ) {
case 'random':
$recipe_args['orderby'] = 'rand';
break;
}