Template:RandomChoice
{{{ Division by zero. }}}
Behold, great syntactic sin: First choice!
The math takes the current unix time, modulus the number of parameters given, and returns {{{ that number }}} which thusly returns that numbered parameter. One is added because parameters are one-indexed and modulus returns start at 0.
Of note, the unix time is taken when the page loads, so if you have several random choices on a page, they all line up. We'd need a different extension to get an actual psuedo-random number, but at that point we're doing flat-out coding in our wiki and there's no way in hell that's gonna fly.
See:
Should be the same letter: a==A
might be different: a != a
Works for up to 10 parameters but could easily be extended to 20, 30. I think there's a hard limit of 50 but we are NOT reaching that. Nope nope nope! Likewise, I'm not going to try to handle a zero-parameter case. It returns a big red "Division by zero." as you likely see above, and that should be good enough.
Parameter count expression taken from https://www.mediawiki.org/wiki/Template:Number_of_defined_parameters .
God help us all. --GreytideSkye (talk) 17:28, 14 September 2024 (UTC)