www.webdeveloper.com
Results 1 to 6 of 6

Thread: TI-83 calc - random numbers

  1. #1
    Join Date
    Jun 2003
    Location
    UK
    Posts
    789

    Question TI-83 calc - random numbers

    Hi,

    On my TI-83, the randInt(A,B,C) function picks C amount of random numbers between A and B. The only problem is the numbers picked can be the same. Is there any way to make sure they're different?

    Thanks,

    Neil

  2. #2
    Join Date
    Jun 2003
    Location
    The United States Site: http://kellyj.t35.com
    Posts
    2,561
    not quite sure what the calculator supports

    you could loop as you would in most languages while the number == the same as the previous number (and if true, generates a new number) and this would be done for all numbers, but again, whether or not a calculator supports, not quite sure

    maybe http://www.ti.com/ has some info. about it

  3. #3
    Join Date
    Aug 2003
    Posts
    1,576
    you'll need to do a while loop and map all your values to a list (basically a calculator array). Then have the while loop to see if a number is already on the list before adding the current random number. I did something similar when I made minesweeper for my ti92, shouldn't be too difficult

  4. #4
    Join Date
    Jun 2003
    Location
    UK
    Posts
    789
    The calculator has its own programming language - I think. It supports while loops. How would I do this is in Javascript, or TI-92, and I'll probably be able to convert it?

    Thanks for your replies,

    Neil

  5. #5
    Join Date
    Aug 2003
    Posts
    1,576
    ti92 went something like this (this is off the top of my head, so no guaruntees it will work):
    Code:
    :0->count
    :delvar L1
    :While count<10
    :rand(50)->temp
    :for i,0,dim(L1),1
    :if L1[i]=temp then
    :goto endofloop
    :endIf
    :endFor
    :temp->L1[count]
    :count=count+1
    :lbl endofloop
    :endWhile
    note: ti92 supports multi character variable names, while the ti83 only supports single characters
    note 2: -> indicates a press of the STO button
    note 3: the random number syntax is slightly different on the 92
    note 4: I don't remember if the syntax for a label is lbl or label, so you'll have to fix that for yourself

  6. #6
    Join Date
    Jun 2003
    Location
    UK
    Posts
    789
    Thanks for that - I'll see if I can adapt it.

    Neil

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles