This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Mathematical   [other Mathematical operators]




rand() returns a pseudo-random number between 0 and 1. No argument is required.

Getting 1-based ranges vs. zero-based ranges of values



$MyNumber will be set to one of eleven integers in the range 0 through to 10.

But, what if the '10' argument about is actually a child count:


If the $ChildCount was 10 and $MyNumber were used to fetch a random child using $SiblingOrder($MyNum) the process would fail if $MyNumber were zero. $SiblingOrder numbers from 1. Indeed, in this case the need is for ten integers, one through to ten.

A 1-based range can be achieved:



If the main input is 10, by subtracting 1 the process returns a randomised integer in in the range 0-9 (ten numbers) and then adding back 1 shifts the value range to 1-10.