Calculator Community > TI Calculators

can you make make the ti nspire cx cas choose a number from a list?

(1/1)

bluepower9:
can you make the ti npsire cx cas pick a number if i list out a series of numbers instead of between 2 numbers?

bb010g:
Use randSamp(list,1 (or however many items you want)) where list is a list of anything. randSamp should be supported on any Nspire, not just CAS models.

bluepower9:

--- Quote from: bb010g on April 27, 2014, 01:08:29 am ---Use randSamp(list,1 (or however many items you want)) where list is a list of anything. randSamp should be supported on any Nspire, not just CAS models.

--- End quote ---
how do you make the list?

bb010g:
However you want; you can use a literal, like {1,2,5}, or a function, like seq(2x+1,x,1,10). Any valid list will work.

LDStudios:
In basic:

list := {1,8,9,2,5,7}
number := randSamp(list,1)

In lua:

list = {1,8,9,2,5,7}
number = list[math.random(1,table.getn(list))]

Navigation

[0] Message Index

Go to full version