SelectFrom Parameters

Top  Previous  Next

A Selectfrom parameter selects n values from an existing parameter.

 

$s=selectfrom($d,5)

or $s=selectfrom($d[],5) if $d is not a list

 

 

$s will contain 5 values randomly selected from $d.

 

Some examples

 

$d=range(1,20)

$s=selectfrom($d[],3)

 

$s might contain 4,7,18. The [] is required so $s selects from the full range of values and not just the one value in $d.

 

$d=deck()

$s=selectfrom($d,5)

 

$s might contain

 

6♠ 5♥ J♥  6♣  10♦

 

$d=list("Aaron","Barry","Cyril","Douglas","Egbert","Francis","Gerald","Hector","Ignatius","Jasper")

$s=selectfrom($d,2)

 

$s might contain "Cyril","Ignatius"

 

You access the results of the selectfrom parameter using references.

 

$s[1], $s[2]... and so on.