What's the best way to do the randIntNoRep() command on an 83+? Is there some voodoo-like combination of commands, or is it a programmed thing?
GTemples27 wrote:
What's the best way to do the randIntNoRep() command on an 83+? Is there some voodoo-like combination of commands, or is it a programmed thing?


I think this should work:

Code:
E-S+1->dim(L1
rand(Ans->L2
S-1+cumSum(1 or L1->L1
SortA(L2,L1
DelVar L2L1


S = start
E = end
L1 = randIntNoRep( list
I propose the following alternative:
Code:
rand(E-S+1->L2
seq(X,X,S,E->L1
SortA(L2,L1
DelVar L2
...Woah.
Kerm: Can you explain what just happened there? I don't get that first line, but I get the rest...
GTemples27 wrote:
...Woah.
Kerm: Can you explain what just happened there? I don't get that first line, but I get the rest...


Basically the first line generates a list of E-S+1 random real numbers 0≤x<1. Then the program sorts the list of integers based on this list, so that they are in random order. It does the same thing as mine, just in a more optimized way. Also, the L1 at the end of mine just returns L1 so that it is more like randIntNoRep(), but you can also just use L1 directly, which is possibly more useful.
Well, what's the point of L2 if you just delete it? L1 and L2 don't interact, right?

EDIT: Ohhhhhhhhh... never mind.
GTemples27 wrote:
Well, what's the point of L2 if you just delete it? L1 and L2 don't interact, right?


The program uses L2 to sort L1 in random order. You have to use L2 because SortA( only takes list names as parameters.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement