Author Link Not Displaying

You have to use setup_postdata function if you want to use the_author_link with custom loop. Do it like this:

<h2 class="sidebarheaders">Random Posts By You </h2>
<br/>
<?php
$rand_posts = get_posts( array( 'numberposts' => 5, 'orderby' => 'date' ) );
foreach( $rand_posts as $post ) : 
    setup_postdata( $post );

    ?><li><a href="https://wordpress.stackexchange.com/questions/89309/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    Written by: <?php echo the_author_link(); 

endforeach;

wp_reset_postdata();
?>

Don’t forget to call wp_reset_postdata to restore the $post global to the current post in the main query.

tech