Help:Random selection

From Memory Alpha, the free Star Trek reference.

Jump to: navigation, search
Help  Contents → Random selection

The RandomSelection MediaWiki extension can be used to generate a random option from a given set.

[edit] Syntax

 <choose>
 <option>Option 1</option>
 <option>Option 2</option>
 </choose>

This example will display a flag image corresponding to one of the Memory Alpha languages:

 <choose>
 <option>[[Image:us-flag.gif]]</option>
 <option>[[Image:de-flag.gif]]</option>
 <option>[[Image:fr-flag.gif]]</option>
 <option>[[Image:cs-flag.gif]]</option>
 <option>[[Image:pt-flag.gif]]</option>
 <option>[[Image:nl-flag.gif]]</option>
 <option>[[Image:es-flag.gif]]</option>
 <option>[[Image:sv-flag.gif]]</option>
 <option>[[Image:ru-flag.gif]]</option>
 <option>[[Image:zh-flag.gif]]</option>
 <option>[[Image:pl-flag.gif]]</option>
 <option>[[Image:ro-flag.gif]]</option>
 <option>[[Image:ja-flag.gif]]</option>
 <option>[[Image:uk-flag.gif]]</option>
 </choose>
Image:us-flag.gif


Note that you can weight the options. This example will give a 3x weighting to option 1:

 <choose>
 <option weight="3">Option 1</option>
 <option>Option 2</option>
 </choose>

Links, images, and templates can all be included as options.

See Random Pic of the Day for an example of this extension in use.

Personal tools