[PD] Random

Ingo Stock mail at ingostock.de
Wed May 30 16:57:52 CEST 2018

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random.pd
Type: text/x-pd-l2ork
Size: 646 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180530/7673a40d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random2.pd
Type: text/x-pd-l2ork
Size: 824 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180530/7673a40d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180530/7673a40d/attachment.sig>

More information about the Pd-list mailing list