BBC HomeExplore the BBC
This page was last updated in July 2006We've left it here for reference.More information

1 January 2010
Accessibility help
Text only

BBC Homepage
OpenSource
About
Projects
Licensing
FAQ

Contact Us

Like this page?
Send it to a friend!

 

Introduction - mod_ssi_func_rnd

This module provides a random function. It runs to two modes, a 'min-max' mode with number ranges, and an item mode, where variable is set from a list of items.

parameters

For min-max mode:

min
lower end of the range
max
upper end of the range

For item mode:

item
item to randomly use the value, this parameter would be used multiple times, see example

Result

A random number or an item value is returned.

Examples

Min-max mode:

The following would set the variable "0", "1" or "2" :

<!--#func var="rnd" func="random" min="0" max="2" -->

The following ranges can be used :

<!--#func var="rnd" func="random" min="-10" max="10" -->
<!--#func var="rnd" func="random" min="0" max="10"  -->
<!--#func var="rnd" func="random" min="-50" max="-40" -->

Item mode

The following would set the variable "rnd" to "red" or "green" or "blue" :

<!--#func var="rnd" func="random" item="red" item="green" item="blue" -->

Requirement

mod_ssi_func_flastmod requires mod_ssi_func as a parent function to be loaded to work.

The ordering of the parameters as set out in the examples is important, ordering these differently will result in the function not working.