Author Topic: can you make make the ti nspire cx cas choose a number from a list?  (Read 5259 times)

0 Members and 1 Guest are viewing this topic.

Offline bluepower9

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
    • View Profile
can you make the ti npsire cx cas pick a number if i list out a series of numbers instead of between 2 numbers?

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: can you make make the ti nspire cx cas choose a number from a list?
« Reply #1 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.
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline bluepower9

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
    • View Profile
Re: can you make make the ti nspire cx cas choose a number from a list?
« Reply #2 on: April 29, 2014, 02:05:40 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.
how do you make the list?

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: can you make make the ti nspire cx cas choose a number from a list?
« Reply #3 on: April 29, 2014, 09:55:55 am »
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.
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
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))]