Fb:random
From Facebook Developer Wiki
Contents |
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.
Attributes
| Required | Name | Type | Description | |
| 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.) |
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 |
Notes
- Weights of options are relative to the number of options left, which shrinks if
unique==trueandpick>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.
