For example, throwing a dice 10 times, the result could be recorded by 2 lists:
L1 = {1,2,3,4,5,6}
L2 = {1,2,1,3,2,2}
Is there an easy way to generate a sample list, say
L3 = {1,2,2,3,4,4,4,5,5,6,6}?
I'm not sure if there are any TI-BASIC functions that can do this already, but this is the type of situation where a sorting algorithm comes in handy.

Edit:

I see what you're looking for now, disregard what I initially said.

The only way that I know to do this is to iterate through the distribution list in a for-loop, then use another for-loop to append the # of elements you read to the list. You'd initialize the output list's dimensions by using sum( on the distribution list.
slimeenergy wrote:
I'm not sure if there are any TI-BASIC functions that can do this already, but this is the type of situation where a sorting algorithm comes in handy.
Sorry I don't get it.. how would a sorting algo help here?
I did not understand the question. I do now. See Jacobly's reply.

Code:
seq(L₁(1+sum(X>cumSum(L₂))),X,1,sum(L₂→L₃
  
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