Search code examples
randomti-basic

Simulating the randIntNoRep( command on the TI 83


The randIntNoRep( command has been released for the TI-84+/SE calculator on OS 2.53MP and above.

The command is used when you need to create a list of numbers in random order in which no integer is repeated. It is very useful for shuffling a sequence of any numbers. How can I implement this functionality on an earlier version (OS or device-wise)?


Solution

  • This can be achieved by creating a list of random numbers, and using it to sequence a second list of the numbers that you want randomized.

    For example, randomizing a 52 card deck and saving it as a list can be done easily with randIntNoRep( :

    :randIntNoRep(0,51→L₁
    

    This can be simulated using the following code:

    :rand(52→L₂
    :seq(X,X,0,51→L₁
    :SortA(L₂,L₁
    

    L₂ is set to contain a set of 52 random values. L₁ is set to contain the numbers that will be randomized. By sequencing the lists in ascending order, the same method can be achieved as using randIntNoRep(.