[PD] Shuffling arrays

Claude Heiland-Allen claudiusmaximus at goto10.org
Mon Oct 4 16:56:10 CEST 2010


On 03/10/10 23:21, Andrew Faraday wrote:
>
> Hey Guys
> I've recently come across the .shuffle method in Ruby which randomly re-orders the content of an array. Does anyone know of a way to do this in Pd, that is, either change the order of notes within an array or output them in a random order (without repeating any part of it)?
> Help would be appreciated
> Andrew 		 	   		

You can pick pairs of indices at random and swap them with 
tabread/tabwrite; repeat to shuffle more.

I used a similar technique to gradually sort an array (swap random 
elements only if they are out of order):

https://code.goto10.org/svn/maximus/2007/clouds-are-made-of-water/
http://www.archive.org/details/ClaudiusMaximus_-_Clouds_Are_Made_Of_Water
(track 5)


Claude
-- 
http://claudiusmaximus.goto10.org



More information about the Pd-list mailing list