you can do this using two list stores, see the file Em qui., 13 de jan. de 2022 às 09:34, Peter P. <[email protected]> escreveu:
> Hi list, > > i am trying to get random permutations of the elements of a list. The > mailinglist archive gives some results using largely externals from > about twenty years ago, I wonder if any internal object can do that by > now? > > Thanks for all pointers, > P > > > > _______________________________________________ > [email protected] mailing list > UNSUBSCRIBE and account-management -> > https://lists.puredata.info/listinfo/pd-list >
#N canvas 476 140 450 300 12; #N canvas 0 0 450 473 randomPermute 0; #X obj 37 37 inlet; #X obj 37 426 outlet; #X obj 70 309 list store; #X obj 37 379 list store; #X obj 37 62 t b l b, f 20; #X obj 105 88 t l l; #X obj 49 116 list length; #X obj 49 141 t f f; #X obj 49 166 until, f 7; #X obj 49 191 f; #X obj 83 192 - 1; #X obj 49 240 random; #X obj 49 216 t b f; #X obj 174 346 t a; #X msg 49 265 get \$1 1 \, delete \$1; #X msg 70 334 append \$1; #X connect 0 0 4 0; #X connect 2 0 15 0; #X connect 3 0 1 0; #X connect 4 0 3 0; #X connect 4 1 5 0; #X connect 4 2 13 0; #X connect 5 0 6 0; #X connect 5 1 2 1; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 7 1 9 1; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 9 0 12 0; #X connect 10 0 9 1; #X connect 11 0 14 0; #X connect 12 0 11 0; #X connect 12 1 11 1; #X connect 13 0 3 1; #X connect 14 0 2 0; #X connect 15 0 3 0; #X restore 93 105 pd randomPermute; #X listbox 93 130 20 0 0 0 - - - 0; #X msg 93 80 list a b c 1 2 3 4 d e f; #X connect 0 0 1 0; #X connect 2 0 0 0;
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
