Shuffle Parameter - Shuffling a Range of Values

Top  Previous  Next

Shuffle parameters produce a randomized set of values. Shuffle parameters are defined using the shuffle command.

 

Note that a shuffle parameter can produce a large set of values - all of which are stored. Shuffle parameters are always limited to 10000 results to limit the impact that large parameters will have on your computer.

 

$p=shuffle(low,high,increment (optional))

 

Examples:

 

$p=shuffle(1,100)                $p will shuffle integers from 1 to 100.

$q=shuffle(2,4.5,0.001)        $q will shuffle values from 2 to 4.5 in 0.001 increments.

$r=shuffle(0,3pi,pi/4)                $r will shuffle values from 0 to 3π in increments of π/4. The values will be inserted as decimals.

 

Using Shuffle Parameters

If you create the parameter $s=shuffle(1,10) and use $s in an equation, the parameter will be replaced by the shuffled list.

 

Example:

 

The horse barrier draw was $s

 

might be turned into

 

The horse barrier draw was 5,3,6,1,7,8,2,9,10,4

 

More commonly, you will use shuffle parameters with references. Using the $s example, you might write.

 

The results of the race were, first $s[1] followed by $s[2] and $s[3].

 

which will be transformed into

 

The results of the race were, first 5 followed by 3 and 6.