Omnimaga

Calculator Community => TI Calculators => Topic started by: bluepower9 on April 26, 2014, 06:37:04 pm

Title: can you make make the ti nspire cx cas choose a number from a list?
Post by: bluepower9 on April 26, 2014, 06:37:04 pm
can you make the ti npsire cx cas pick a number if i list out a series of numbers instead of between 2 numbers?
Title: Re: can you make make the ti nspire cx cas choose a number from a list?
Post by: 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.
Title: Re: can you make make the ti nspire cx cas choose a number from a list?
Post by: bluepower9 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?
Title: Re: can you make make the ti nspire cx cas choose a number from a list?
Post by: bb010g 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.
Title: Re: can you make make the ti nspire cx cas choose a number from a list?
Post by: LDStudios on May 02, 2014, 04:06:36 pm
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))]