Extension talk:Random

version 0.3 works with MW 1.17.0, --Erkan Yilmaz 15:51, 11 August 2011 (UTC)

Shuffled results
As of PHP version 5.2.10, "The resulting array of keys is no longer shuffled." by array_rand. Thus, items will be randomly selected, but will remain in the order they start in. Add

just above

and

above

to restore the original behavior.

70.186.139.54 20:49, 16 April 2014 (UTC)

Not work with 1.22 - 1.23
With this error: Exception from line 316 of /includes/MagicWord.php: Error: invalid magic word 'random'. --UksusoFF (talk) 10:47, 29 April 2014 (UTC)
 * I have the same problem with 1.23.0. --2A01:E35:2F06:89B0:224:54FF:FE65:19AE 19:55, 7 July 2014 (UTC)
 * All 4 examples worked for me on a fresh Mediawiki 1.23.2. Can you try again? --Erkan Yilmaz (talk) 10:46, 12 August 2014 (UTC)
 * Same here. Error:

[ba...] /db/index.php?title=Foo Exception from line 318 of /path/includes/MagicWord.php: Error: invalid magic word 'random' Backtrace:
 * 1) 0 /path/includes/MagicWord.php(241): MagicWord->load(string)
 * 2) 1 /path/includes/parser/Parser.php(4984): MagicWord::get(string)
 * 3) 2 /path/extensions/Random/Random.php(33): Parser->setFunctionHook(string, string, integer)
 * 4) 3 [internal function]: efRandomExtension(Parser)
 * 5) 4 /path/includes/Hooks.php(206): call_user_func_array(string, array)
 * 6) 5 /path/includes/GlobalFunctions.php(4013): Hooks::run(string, array, NULL)
 * 7) 6 /path/includes/parser/Parser.php(275): wfRunHooks(string, array)
 * 8) 7 /path/includes/cache/MessageCache.php(1023): Parser->firstCallInit
 * 9) 8 /path/includes/cache/MessageCache.php(1000): MessageCache->getParser
 * 10) 9 /path/includes/Message.php(977): MessageCache->transform(string, boolean, Language, Title)
 * 11) 10 /path/includes/Message.php(669): Message->transformText(string)
 * 12) 11 /path/includes/Message.php(732): Message->toString
 * 13) 12 /path/includes/OutputPage.php(853): Message->text
 * 14) 13 /path/includes/OutputPage.php(899): OutputPage->setHTMLTitle(Message)
 * 15) 14 /path/includes/Article.php(556): OutputPage->setPageTitle(string)
 * 16) 15 /path/includes/actions/ViewAction.php(44): Article->view
 * 17) 16 /path/includes/Wiki.php(428): ViewAction->show
 * 18) 17 /path/includes/Wiki.php(292): MediaWiki->performAction(Article, Title)
 * 19) 18 /path/includes/Wiki.php(588): MediaWiki->performRequest
 * 20) 19 /path/includes/Wiki.php(447): MediaWiki->main
 * 21) 20 /path/index.php(46): MediaWiki->run
 * 22) 21 {main}
 * My guess you have to map the magic word. --Subfader (talk) 16:10, 1 October 2014 (UTC)

Database exception / error with MW 1.26.2
Installed this with 1.26.2 and got a Database error. Fixed (as far as I can tell) by following the "map magic word" instruction linked below.

Specifically, add this line to Random.php : $wgExtensionMessagesFiles['Random'] = dirname(__FILE__). '/Random.i18n.magic.php';

Then, create a file called Random.i18n.magic.php and insert the following in:

 array( 0, 'random' ), );