Display custom posts randomly in custom taxonomy archive

I’ve finally found the solution thanks to a friend of mine:

exploiting

get_queried_object()

we can set the object name in the script as follows:

<?php
    $obj=$wp_query->get_queried_object();

    $args=array(
    'tax_query' => array(
        array(
            'taxonomy' => 'areas',
            'field' => 'slug',
            'terms' => $obj->name
            )
        ),
        'orderby' => 'rand'
    );

    query_posts($args);
?>

Hope this can help.

Enjoy! 🙂