How to show blog posts changing every time after refreshing the page in non-wordpress website?

This line is responsible for posts that are showing:

query_posts('showposts=4');

All you tell in it is “take 4 posts” and WP will take 4 most recent posts, because that’s the default behavior.

If you want to take random posts, you have to tell WP to order posts randomly:

query_posts( array(
    'posts_per_page' => 4,
    'orderby' => 'rand'
) );