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

Template:Random item

  • Template
  • Talk
  • Language
  • Watch
  • View source
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

  • {{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

  • |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

Purge

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

See also

  • 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&oldid=1080613446"
Last edited on 2 April 2022, at 09:14

Languages

    • বাংলা
    • भोजपुरी
    • Català
    • فارسی
    • Français
    • Bahasa Indonesia
    • Kurdî
    • Ladin
    • ਪੰਜਾਬੀ
    • پښتو
    • Slovenščina
    • کوردی
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 2 April 2022, at 09:14 (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