Shuffling a Range of Values
|Top Previous Next|
Shuffle parameters produce a randomized set of values. Shuffle parameters are defined using the shuffle command.
$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.
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 followed by $s and $s.
which will be transformed into
The results of the race were, first 5 followed by 3 and 6.