Fixed function to calculate random blog posts