Display Random Posts with thumbnail instead of just a title of the post

You can get the post thumbnail HTML using the function get_the_post_thumbnail(), so you just need to replace get_the_title() with that function:

$string .= '<li><a href="'. get_permalink() .'">'. get_the_post_thumbnail() .' </a></li>';

By default the image will be the size defined by your theme, but you use any of the other available sizes by passing the size name as the 2nd argument of the function:

$string .= '<li><a href="'. get_permalink() .'">'. get_the_post_thumbnail( null, 'large' ) .' </a></li>';