# A “random page” user script useful to improve the site

I am trying to navigate our main site to find question and answers to improve:

• Edit posts which I can fix
• Up and down vote what I can
• Vote to close or reopen
• Flag those lengthy comment threads and other broken windows for mod attention

and so on.

However, there seem to be no easy way of finding a "random" selection of posts to review holistically.

Is there a script I can use?

## 2 Answers

Yes, why, I am surprised you asked!

You can use the very efficient Random Post v0.1™ user script!

1. Install the user script available as a gist here.

2. Go fetch any Physics.SE page.

3. Notice the die on the top right

4. Click on the die to go to a completely random post!

• You may want to post this on StackApps as well :) – Manishearth Dec 23 '12 at 17:54
• @Manishearth It only works on physics, until I figure out how to extract the maximum postId for each site :-) – Sklivvz Dec 23 '12 at 18:02
• GET request api.stackexchange.com/2.1/info?site=stackoverflow. Use api.stackexchange.com/docs/… to customize the query. – Manishearth Dec 23 '12 at 18:06
• Alternatively, whenever the user is on the main page,check all the question ids on the page and update a "max_known_postid" variable in localStorage. No need for AJAX then. – Manishearth Dec 23 '12 at 18:07
• @Manishearth thanks. The first method does not give out the MAX(Id), just the COUNT(Id), which is useless to us ... I could do the second but of course stateless would be better :-) – Sklivvz Dec 23 '12 at 18:12
• Thanks for this, Sklivvz. Now if only things could settle down enough that I can find so time to play with it... – dmckee --- ex-moderator kitten Dec 23 '12 at 20:58

While not a script, you can get much more targeted results through the Stack Exchange Data Explorer.

There are weekly refreshes, so if you're looking for anything less than a week old, it won't show up in the query.

Basically, you want to use the newid() function in SQL to order by. A new GUID is produced for every single row (this expression is not evaluated one time and then cached).

That means that you can get a completely random set of questions every time.

Add the [Post Link] and then you get a list of URLs that you can use to navigate to the post.

select
p.Id as [Post Link],
p.*
from
Posts as p with (nolock)
where
--- Just questions for now
p.PostTypeId in (1)

--- Add new filter criteria here
--- to suit your needs.

order by
--- Randomize each time.
newid()


Note the --- Add new filter criteria here to suit your needs. comment. You should adjust the filter in order to target the posts that you specifically want. For example, you might check the ClosedDate column is null to filter out closed posts.

Also note that you can change this query to work on any site by selecting "Switch sites" on by the "Run Query" button: