Memory Alpha
Advertisement
Memory Alpha
Help Contents → Random selection

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

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>[[File:us-flag.svg|18px]]</option>
 <option>[[File:bg-flag.svg|18px]]</option>
 <option>[[File:ca-flag.svg|18px]]</option>
 <option>[[File:de-flag.svg|18px]]</option>
 <option>[[File:fr-flag.svg|18px]]</option>
 <option>[[File:cs-flag.svg|18px]]</option>
 <option>[[File:pt-flag.svg|18px]]</option>
 <option>[[File:nl-flag.svg|18px]]</option>
 <option>[[File:es-flag.svg|18px]]</option>
 <option>[[File:sv-flag.svg|18px]]</option>
 <option>[[File:ru-flag.svg|18px]]</option>
 <option>[[File:zh-flag.svg|18px]]</option>
 <option>[[File:pl-flag.svg|18px]]</option>
 <option>[[File:ro-flag.svg|18px]]</option>
 <option>[[File:ja-flag.svg|18px]]</option>
 <option>[[File:uk-flag.svg|18px]]</option>
 </choose>
De-flag

Note that you can weight the options. This example will give a 3× 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.

Advertisement