Manual:Random page

A random page can be viewed via Special:Random. This uses the  function, which is capable of avoiding duplicate values for up to approximately 4,611,686,014,132,420,609 (i.e., ≈ $$(2^{31} - 1)(2^{31} - 1)$$) articles, and the  values from the page>Special:MyLanguage/Manual:Page table|page table. The  hooks>Special:MyLanguage/Manual:Hooks|hook can be used to modify the selection criteria. The   config>Special:MyLanguage/Manual:Configuration settings|configuration setting was used as a filter, but has been deprecated in v1.16.

In , the RAND function is used to populate page_random</>.

By default, selection will be limited to pages from namespaces in <tvar|ContentNamespaces> </>. The user can choose which namespace to look in. For example, if they wanted to view a random file they could go to <tvar|random-file>Special:Random/file</>. If they wanted to view a random mainspace page they could go to <tvar|random-main>Special:Random/main</>, etc.

The file that implements this feature is <tvar|rnd-file>SpecialRandompage.php</>. <tvar|rnd-redir>SpecialRandomredirect.php</> (<tvar|rnd-redirect>Special:Randomredirect</>) directs the user to a random redirect page (minus the second redirect). There is an array,, that allows for adding extra SQL statements to the query for selecting a random page from the database.