Description
Previously, before the order="random" attribute was available, there was no way to have a link which would display a random page.
The workaround used was the "single block of many pages" technique.
However, since the creation of this new attribute, it has become possible to use the ListPages module to create this.
Code
[[module ListPages category="*" order="random" limit="1" range="others"]]
[%%link%% Random page!]
[[/module]]
In action
Alternative
In some web-browsers, the URL is shown as the user hovers the mouse over it. If you don't want the user to see the URL of the page on a mouse-hover, then you should create a "Random Page" page containing the following code:
[[module ListPages category="*" order="random" limit="1" range="others"]]
[[iframe http://snippets.wdfiles.com/local--code/code:iframe-redirect#%%link%%]]
[[/module]]
Then you make your "random link" link to that page.
In action
Limitations and their solutions
Due to the nature of the order="random" attribute, the "random" page is not selected on the spot (it changes every 60 seconds).
Solutions
The solution to this limitation would be to place it in the side bar, because the link is different on every page loaded. More explained, you can click the link in the side bar, and the loaded page will have a fresh new link in the same side navigator (so you can click it again).
Thanks to James Kanjo putting random page link in the top bar is also possible. The trick is that closing module brackets ([[/module]]), must be put AFTER the other links or buttons you have in your top bar, i.e. all other links and buttons must be placed inside the ListPages module.
Here:
[[module ListPages category="whatever category" order="random" limit="1" skipCurrent="true"]]
* [%%link%% Random page]
* Home
* Whatever link
* Whatever link
* Print button
* Edit button
* Any other button or link
[[/module]]
It is not necessary that Random page link gets the first on the list. You can put it wherever you want, but it must stay inside module brackets.
[[module ListPages category="whatever category" order="random" limit="1" skipCurrent="true"]]
* Home
* Whatever link
* Whatever link
* **[%%link%% Random page]**
* Print button
* Edit button
* Any other button or link
[[/module]]