How to get to a specific position in wp_query?

I think instead of using PHP rand you’re better off limiting ( if you need to ) using posts_per_page and then getting a random set using orderby => 'rand'.

Full List of Ordering Parameters

So if I were to edit your query it would look like this:

$args = array(
   'post_type'  => 'attachment',
   'meta_key'   => 'on_front_page',
   'meta_value' => '1'
   'orderby'    => 'rand'
   'posts_per_page' => 6
);

$slides = new WP_Query($args);
$total_images = (int) $slides->found_posts;

if( $slides->have_posts() ) {
    while( $slides->have_posts() ) {
        echo $post->ID;  // The Attachment ID
    }
}