3 function wfSpecialRandompage()
5 global $wgOut, $wgTitle, $wgArticle, $force;
6 $fname = "wfSpecialRandompage";
9 $rand = mt_rand() / mt_getrandmax();
10 # interpolation and sprintf() can muck up with locale-specific decimal separator
11 $randstr = number_format( $rand, 12, ".", "" );
12 $sqlget = "SELECT cur_id,cur_title
13 FROM cur USE INDEX (cur_random)
14 WHERE cur_namespace=0 AND cur_is_redirect=0
15 AND cur_random>$randstr
18 $res = wfQuery( $sqlget, $fname );
19 if( $s = wfFetchObject( $res ) ) {
20 $rt = wfUrlEncode( $s->cur_title
);
26 $wgOut->reportTime(); # for logfile
27 $wgOut->redirect( wfLocalUrl( $rt ) );