[PD] A couple new list-abs

Frank Barknecht fbar at footils.org
Thu Mar 6 15:20:11 CET 2008


Hallo,
Luke Iannini (pd) hat gesagt: // Luke Iannini (pd) wrote:

> Here's another quick pair, again inspired by Python libraries (sorry,
> Python just seems to love lists as much as Pd .39+ and I do), this
> time the random module.
> 
> [list-sample n] grabs a random bunch of n unique items from the
> incoming list and outputs them as a new list.
> 
> list-shuffle is a shortcut to [list-sample]ing the same number of
> items as were in the list originally, which results in a shuffled
> list.

Careful here: [list length] behaves differently in 0.39 and 0.40+!
Better use [list-len], which is the consistent. Similar caution is
necessary when using [urn], which also has two incompatible
implementations. You may want to use urne.pd from RTC-lib, but then
RTC-lib already includes a kind of list-shuffle/list-sample called
scramble.pd

  [scramble] 
  |
  [list split N]

looks as if it is the same as [list-sample N].

Ciao
-- 
 Frank Barknecht                                     _ ______footils.org__




More information about the Pd-list mailing list