• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Random item/sandbox

  • Template
  • Talk
  • Language
  • Watch
  • Edit
< Template:Random item
This is the template sandbox page for Template:Random item (diff).
See also the companion subpage for test cases.
Template documentation[view] [edit] [history] [purge]
This template should be substituted if you want to generate a random item one time only.
This template uses Lua:
  • Module:Random (sandbox)

Returns one of N items at random.

Contents

  • 1 Usage
  • 2 Parameters
  • 3 Examples
  • 4 See also

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 used to be a |range= parameter, but this is no longer needed.

Examples

edit

Purge

  • {{Random item|a|b|c|d|A|B|C|D|1|2|3|4}} → B
  • {{Random item|a|b|c|d|A|B|C|D|1|2|3|4}} → 3
  • {{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}} → 4
  • {{Random item|a|b|c|d|A|B|C|D|1|2|3|4|same=y}} → 4
  • {{Random item|a|b|c|d|A|B|C|D|1|2|3|4|same=y}} → 4

See also

edit
  • Template:Random number
The above documentation is transcluded from Template:Random item/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Random_item/sandbox&oldid=945296376"
Last edited on 13 March 2020, at 01:46

Languages

      This page is not available in other languages.

      Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited on 13 March 2020, at 01:46 (UTC).
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of Use
      • Desktop