#TI-BASIC
TI-BASIC
No computer handy? This works on all TI-83/84/+/SE calculators.
PROGRAM:RANDOM
:"NEW ARRAY NAME:"
:"JOHN"
:"JEFF"
:"EMMA"
:"STEVE"
:"JULIE"
:Disp "NAMES[floor(rand*5)]"
:Disp "NAME: ",Ans
The names are successively set into
Ans
(soJULIE
would be the contents ofAns
). Then, theNAMES[floor(rand*5)]
is piped away as a useless string, and the last line looks line it is pulling one of the names from the arrayNAME
(which doesn't exist, by the way). Instead, it will always displayJULIE
. The order of the names can be switched around to provide a different victim on demand.