Fb:random

From Facebook Developers Wiki

Jump to: navigation, search

Contents

[edit] Description

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

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


[edit] Attributes

RequiredNameTypeDescription
optional pick int The number of items to choose from the random subset. (default value is 1)
unique bool Indicates whether to force uniqueness if pick > 1. (default value is true)


[edit] Examples

<fb:random> <fb:random-option weight="2">A: This will be shown 2 times as often as B.</fb:random-option> <fb:random-option weight="1">B: This will be show half as often as A</fb:random-option> </fb:random>
a screenshot is not applicable for this tag


[edit] 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.
  • This tag may contain fb:random-option.