MediaPost Social Network

Up:random

Randomly chooses an item inside the tags based on the weights provided.

Description

up:random allows the developer to input a series of tags, of which 1 or more will be shown randomly. Each item can have a weight and the tag can be specified to show more than one of the choices. Each option should be wrapped in an up:random-option tag.

Attributes

  • Optional
    • int pick - The number of items to choose from the random subset. (default value is 1)
    • bool unique - Whether to force uniqueness if pick > 1. (default value is true)

Notes

  • Weights of options are relative to the number of options left, which shrinks if unique==true and pick > 1.
  • Weights of options can be any float > 0. The weights are relative to each other, not necessarily to 1.

May Contain

Sample Code

  <up:random>
      <up:random-option weight="2">A: This will be shown 2 times as often as B.</up:random-option>
      <up:random-option weight="1">B: This will be show half as often as A.</up:random-option>
   </up:random>