Skip to main content
3 of 3
Commonmark migration

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 (so JULIE would be the contents of Ans). Then, the NAMES[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 array NAME (which doesn't exist, by the way). Instead, it will always display JULIE. The order of the names can be switched around to provide a different victim on demand.

Timtech
  • 12.6k
  • 2
  • 45
  • 61