Random Numbers Generator

[rann]

Overview

Random Numbers Generator is a WordPress plugin that allows authors to use a shortcode to display formatted random numbers.

The shortcode displays a numerical value within a declared range and in the format specified every time the content of a page is refreshed. The shortcode also allows for values to be re-used statically within a context. Typically, random numbers are used to test interfaces and for demonstration purposes. For example, you can use the shortcode in fake price comparison tables, various numerical property widgets, etc.

Syntax

The shortcode syntax uses the following pattern – where the labels inside slash pairs indicate optional attributes:

[rann /range/ /format/ /use/]

Identifier

[rann]

Example: [rann] displays 0 -- the default value when no range is specified.

Attributes

Note: Quotation marks around a shortcode attribute's parameter are optional, unless the latter includes one or more space characters.

range

NameDescription
parameter valueThe minimum value, followed by the maximum value, separated by a comma. The resulting range is inclusive of the bounding values. Ex.: "8,10", "9,999", etc.
outputA random number between the minimum and maximum values.
default value"0,0"
usage example[rann range=1,10] display 3 -- or any number between 1 and 10.

format

NameDescription
parameter valueIf present, any string containing at least the hash (#) character. The hash character is a placeholder for the generated number. If a single digit integer follows the #, the number will be formatted with the number of decimals it specifies. Any other string specified in the format declaration will be echoed as is. Ex.: "$#.95", "# little bears", etc.
outputA formatted string of characters including the random number.
default value"#"
usage example[rann range=1,5 format=$#2] displays $3.00

use

NameDescription
parameter valueA string specifying a register. When the "use" attribute is declared, the instance of the random number becomes available for reuse under that value.
outputThe value held in the static register.
default value[none]
usage example[rann range=3,6 use=mynumber] displays 4 and declares "mynumber" to be 4; thereafter, [rann use=mynumber] will display 4.

Examples

ExampleResult
[rann range=1,100]An integer between 1 and 100.
[rann range=0.25,2.5 format=#2]A float between 0.25 and 2.50
[rann range=-100,100 format=$#]A signed integer between -100 and 100, preceded by the dollar sign.
[rann range=1,10 use=mytoken format=$#.95]An integer between 1 and 10 preceded by a dollar sign and followed by “.95”; stores the result in "mytoken" for later use.
[rann use=mytoken]The raw integer registered in the previous example.

Information

NameDescription
version1.0
DownloadClick here to download
WordPress Plugins pageClick here to visit
SupportUse the comment section below to ask a question, request a new feature, report a bug or post a relevant comment.

Warning: Undefined array key "preview" in /home/plugins/public_html/wp-content/plugins/oxygen/component-framework/components/classes/comment-form.class.php on line 75

Leave a Reply

Your email address will not be published. Required fields are marked *


Warning: Undefined array key "preview" in /home/plugins/public_html/wp-content/plugins/oxygen/component-framework/components/classes/comment-form.class.php on line 79

Warning: Undefined array key "preview" in /home/plugins/public_html/wp-content/plugins/oxygen/component-framework/components/classes/comments-list.class.php on line 90

Warning: Undefined array key "preview" in /home/plugins/public_html/wp-content/plugins/oxygen/component-framework/components/classes/comments-list.class.php on line 102

Warning: Undefined array key "preview" in /home/plugins/public_html/wp-content/plugins/oxygen/component-framework/components/classes/comments-list.class.php on line 113

Warning: Undefined array key "action" in /home/plugins/public_html/wp-content/plugins/oxygen/component-framework/components/classes/comments-list.class.php on line 113
plugins.logo
Copyright © Codecide