One way to do this would be to use post__not_in
because you are using 'orderby' => rand,
.
You will need to throw the post or attachment ID ( I suppose you can also use something else) into and array in the first loop and use that array in as a second query parameter, in essence you are doing 2 loops.
I don’t have to ability to test the actual code but the logic would be along the lines of;
$remove_duplicates = array(); //create an array to hold post id's (or whatever you use)
$new_query = new WP_Query('&showposts=24&orderby=rand'); //add your other queries params here
while ($new_query->have_posts()) : $new_query->the_post(); // start first loop
$remove_duplicates[] = $post->ID ?> // throw duplicate post Id's into an array
endwhile; // end first loop
// start second loop for your output using the array
$args=array(
'numberposts' => 1,
'orderby' => rand,
'status' => 'publish',
'post_mime_type' => 'image',
'parent' => $post->ID
'post__not_in'=> $remove_duplicates ); // this is the important part to remove the duplicates.
// rest of your output.
Sorry I was unable to test this, if it doesn’t work , another option would be to just use a native PHP function like array_unique
to remove the duplicates in the array before output.