Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: Wretchedlout on June 04, 2012, 08:43:30 pm
-
Is there an easy way to create a list with dim 26 with:
Rnd integers for each dim#
Any Dim = int 1-26
Dim x =/= x
Ex
Dim 1 = X
Dim X= 1
Dim 2 = Y
Dim Y = 2
Ask if you dont understand
-
So you want a list of 26 random integers from 1 to 26 where each element is not equal to its index?
-
Yes, and the index of the number is = dim(num of index num
-
26→dim(L1
Fill(0,L1
For(A,1,13
1+sum(not(cumSum(0=L1→B
Repeat C≠L1(B) and not(L1(C
randInt(1,26→C
End
C→L1(B
B→L1(C
End
Edit: I realized that I made a mistake.
Edit 2: != means not equal (2nd test 2)
-
:DD thanks
-
i was trying to make one using seq( and SortA but then blue_bear already got the answer :P
-
Well, let's see yours.
-
Herm....
well it seems that about only 1/6 of the time this works. The reason it "dosen't work" is because 5/6 of the time it makes a 0 for one of the variables. Could you please fix this so that only 1-26 are in the variables of the list?
It seems the 0's are in the 20-26th place of the list most of the time
-Thanks :)
-
26→dim(L1
Fill(0,L1
For(A,1,13
1+sum(not(cumSum(not(L1→B
Repeat C≠B and not(L1(C //changed
randInt(1,26→C
End
C→L1(B
B→L1(C
End
Did you type the L1 token (2nd+L1) or the individual letters 'L' '1'?
-
2nd and 1
and it has worked every time now :)
double thanks