Please read about the get_the_permalink and get_the_title. These functions are developed to fetch the details from global $post variable. Your local $post won’t be effective here.
You should either pass local $post
to these functions like get_the_permalink($post)
and get_the_title($post)
. For get_the_content, you will need to use apply_filters('the_content',$post->post_content);
However, preferred way is to create an object of WP_Query. Please read about its a powerful class to query everything about posts. In your case, it will look something like this
<?php
$args = array('posts_per_page'=>3,
'orderby'=>'rand',
'post_type'=>'post'
);
$randomPosts = new WP_Query($args);
while($randomPosts->have_posts()){
$randomPosts->the_post();
echo '<a href="'.get_the_permalink().'">'.get_the_title().'</a><br>';
echo substr(strip_tags(get_the_content()),0,100).'...';
echo "<br>";
}
?>
I have not tested above code but, I guess, you get the idea.