<![CDATA[How to exchange elements random in the same row of the matrix list]]>
https://help.geogebra.org/topic/how-to-exchange-elements-random-in-the-same-row-of-the-matrix-list
Sun, 22 Dec 2019 20:35:02 +0000Sun, 22 Dec 2019 10:14:37 +0000Zend_Feed<![CDATA[A tricky solution with the help of sorting. l1 for 10 rows, 4 indices (column number) per row are determined with a random number l2 The 4 indices from l1 are randomly mixed. l3 Forms the indices in a sequence from 1 to 10. If, however, the current index occurs in the sequence in a certain position of l1, so the index from l2 is taken over with the same position. l3 is the help list for sorting. It can be interpreted as follows: The first value (in one line) of m1 receives as new position the first value from l3. The second value from m1 receives as new position the second value from l3 etc. I have changed the values in m1 so that they are not confused with the indices. The result is formed in m2. ------------------------------- Alternative: Realize the whole thing as a script. there is the command SetValue( <List>, <Number>, <Object> ) However, this would require the matrix to be converted into a one-dimensional list and there is no decent iteration in GGB script. Substitute for this is Execute(< with iteration generated commands>) In the end it probably will be even more tricky than solution above]]>
https://help.geogebra.org/topic/how-to-exchange-elements-random-in-the-same-row-of-the-matrix-list#comment-272806
Sun, 22 Dec 2019 16:39:13 +0000<![CDATA[Thank you. I solved the problem by adding the shuffle command == Sequence(Shuffle(Sequence(If(i ≤ cantV, 1, 0), i, 1, n, 1)), j, 1, n, 1) ]]>
https://help.geogebra.org/topic/how-to-exchange-elements-random-in-the-same-row-of-the-matrix-list#comment-272818
Sun, 22 Dec 2019 20:35:56 +0000