[PD] Random

Jean-Marie Adrien jm.adrien.mnt at gmail.com
Wed May 30 19:59:55 CEST 2018


the text file seems the best since time things might fail cause patch opens everyday at the same computer time…
or maybe take the nanoseconds…which might differ from one occurrence to the other ...

> Le 30 mai 2018 à 16:57, Ingo Stock <mail at ingostock.de> a écrit :
> 
> Another way is to generate a random number, save this number and use it
> as a seed the next time the patch gets opened. This way you will always
> have a fresh seed.
> 
> Two examples attached, random.pd saves the seed within the patch,
> random2.pd saves the seed in a text file. random2.pd throws an error the
> first time, if the text file is not present.
> 
> best, ingo
> 
> 
> On 05/30/2018 04:41 PM, Claude Heiland-Allen wrote:
>> On 30/05/18 15:17, Jean-Marie Adrien wrote:
>>> Hi everyone,
>>> trying to open a patch with a different text on screen each time random.
>>> Used random object as always since 20 years with a loadbang.
>>> Discovered that this loadbang/random seems to generate always the same
>>> result on opening
>>> :)
>> It's a feature.  But not having non-determinism is a bit awkward sometimes.
>> 
>>> What is the correct way to get a random digit on patch load within say
>>> 30 choices ?
>> 
>> You can generate a random number before starting Pd and -send it to your
>> patch on load.
>> (requires knowledge of shell/cmd scripting)
>> (this is the approach I took in my 'dynamo' project:
>> https://code.mathr.co.uk/dynamo )
>> 
>> You can try to read raw binary data from /dev/urandom, perhaps with
>> [soundfiler] or [readsf~]
>> (requires an OS with this device, and I have not tested it)
>> 
>> You could try reading from [adc~] or analogue sensor pins
>> (requires some unpredictable signal input, possibly special hardware)
>> 
>> You could try [delay] with [realtime]
>> (you might get one or two bits of randomness each time)
>> 
>> You could try an external
>> (maybe some function of calendar time will look random enough? I think
>> zexy has date support)
>> 
>> 
>> Claude
> <random.pd><random2.pd>_______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list




More information about the Pd-list mailing list