Random post link generator messes up the loop

Ok, thanks to The Maniac for all the help troublshooting.

Looks like I had to take this completely outside the loop and call the WP_Query class on a new variable to make it happen.

Here’s what worked:

<?php
$query = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => '1' ) );

while ( $query->have_posts() ) : $query->the_post(); ?>

    <a href="https://wordpress.stackexchange.com/questions/226112/<?php the_permalink(); ?>" title="Random Post from Our Blog" style="float:right;" class="random-widget">
        <span class="fa-random" style="font-family:FontAwesome;float:right;"></span>
    </a>

<?php endwhile;
wp_reset_postdata(); ?>