Template:Random item: Difference between revisions
Content added Content deleted
Vivaporius (talk | contribs) m (1 revision imported) |
Vivaporius (talk | contribs) m (1 revision imported) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{{{{#invoke:Random| |
{{{{{|safesubst:}}}#invoke:Random|item}}<noinclude>{{Documentation}}</noinclude> |
||
{{Documentation|content= |
|||
{{Lua|Module:Random}} |
|||
Returns one of {{mvar|N}} items at random. |
|||
== Usage == |
|||
<code><nowiki>{{random item|item1|item2|...|item</nowiki>{{mvar|N}}<nowiki>|range=</nowiki>{{mvar|N}}<nowiki>}}</nowiki></code> |
|||
[[Category:Mathematical function templates]] |
|||
}}</noinclude> |
Latest revision as of 19:33, 14 May 2022
This template should be substituted if you want to generate a random item one time only. |
This template uses Lua: |
Returns one of N items at random.
Usage[edit]
{{random item|item1|item2|...|itemN}}
- All calls to the function using
|same=y
with the same number of items will return the same item.
Parameters[edit]
|1=
..|2=
..|N=
--> The items to return.|same=y
Set to a truthy value for all calls with this parameter set and the same number of items to return the same item.- There use to be a
|range=
parameter, but this is no longer needed.
Examples[edit]
{{Random item|a|b|c|d|A|B|C|D|1|2|3|4}}
--> 4{{Random item|a|b|c|d|A|B|C|D|1|2|3|4}}
--> C{{Random item|a|b|c|d|A|B|C|D|1|2|3|4}}
--> D{{Random item|a|b|c|d|A|B|C|D|1|2|3|4|same=y}}
--> 3{{Random item|a|b|c|d|A|B|C|D|1|2|3|4|same=y}}
--> 3{{Random item|a|b|c|d|A|B|C|D|1|2|3|4|same=y}}
--> 3