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 :) What is the correct way to get a random digit on patch load within say 30 choices ? Tks JM
if you can use adc~ (assuming that your mic can capture some noise) you can sum some snapshots~ with high gain and then voilà, random number each time
Em Qua, 30 de mai de 2018 11:18, Jean-Marie Adrien jm.adrien.mnt@gmail.com escreveu:
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 :) What is the correct way to get a random digit on patch load within say 30 choices ? Tks JM _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On Wed, 2018-05-30 at 11:30 -0300, José de Abreu wrote:
if you can use adc~ (assuming that your mic can capture some noise) you can sum some snapshots~ with high gain and then voilà, random number each time
Attached is a method that doesn't require audio to be on (and thus also no real adc~).
Roman
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)
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
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@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@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
also use zexy/date then? :)
2018-05-30 14:59 GMT-03:00 Jean-Marie Adrien jm.adrien.mnt@gmail.com:
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@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@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/
listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
On Wed, May 30, 2018 at 10:17 AM, Jean-Marie Adrien <jm.adrien.mnt@gmail.com
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 :) What is the correct way to get a random digit on patch load within say 30 choices ?
This patch uses [time] to seed the random sequence.
Martin
2018-05-30 11:45 GMT-03:00 Martin Peach chakekatzil@gmail.com:
This patch uses [time] to seed the random sequence.
I guess this is sort of like how the initial seed is done in Max. Not sure exactly, but it uses some time period since the computer started or something.
I think it is a good idea to include something like that in [random] so it is updated to automatically have a different starting seed every time.
cheers
usually in random number generators one wants to have control on the seed because this allows to have the same numeric streams every time one wants. so, IMHO the best practice is to generate a time-valued seed in some way (e.g. [realtime]) and use it as argument for |seed< method.
ciao
2018-05-30 19:09 GMT+02:00 Alexandre Torres Porres porres@gmail.com:
2018-05-30 11:45 GMT-03:00 Martin Peach chakekatzil@gmail.com:
This patch uses [time] to seed the random sequence.
I guess this is sort of like how the initial seed is done in Max. Not sure exactly, but it uses some time period since the computer started or something.
I think it is a good idea to include something like that in [random] so it is updated to automatically have a different starting seed every time.
cheers
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
2018-05-30 14:29 GMT-03:00 Marco Matteo Markidis mm.markidis@gmail.com:
usually in random number generators one wants to have control on the seed
you still have control on the seed... just seed it
generate a time-valued seed in some way (e.g. [realtime])
how would you do something with that, that each time you start pd it has a different seed? I can see that with [zexy/time], but not realtime
On 05/30/2018 09:15 PM, Alexandre Torres Porres wrote:
different seed? I can see that with [zexy/time], but not realtime
well [realtime] will give you different results, based on what other things your CPU is doing. so there *is* a bit of entropy in their. see roman's patch.
entropy is probably not very high though, but is probably good enough for most musical things (we are not talking cryptography here; getting high entropy is really a hard problem). and it doesn't depend on any external.
fgamdsr IOhannes
Hi,
On 31/05/18 04:07, IOhannes m zmölnig wrote:
On 05/30/2018 09:15 PM, Alexandre Torres Porres wrote:
different seed? I can see that with [zexy/time], but not realtime
well [realtime] will give you different results, based on what other things your CPU is doing. so there *is* a bit of entropy in their. see roman's patch.
Also this patch which uses network connection, file read, etc. to add further entropy:
https://raw.githubusercontent.com/chr15m/SyncJams/master/pure-data/uid.pd https://raw.githubusercontent.com/chr15m/SyncJams/master/pure-data/uid-help....
Chris.
usually in random number generators one wants to have control on the seed because this allows to have the same numeric streams every time one wants.
I thought about this and conclude that the help patch should mention the fact that the sequence is always the same even when the object is not explicitely seeded with the [seed ...< message.
just an idea: what if [seed( without argument would take the current system time?
or even seed it with the system time on creation?
Gesendet: Donnerstag, 31. Mai 2018 um 13:36 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list pd-list@lists.iem.at Betreff: Re: [PD] Random
- Marco Matteo Markidis mm.markidis@gmail.com [2018-05-30 19:29]:
usually in random number generators one wants to have control on the seed because this allows to have the same numeric streams every time one wants.
I thought about this and conclude that the help patch should mention the fact that the sequence is always the same even when the object is not explicitely seeded with the [seed ...< message.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
that's what I was suggesting ;)
2018-05-31 9:15 GMT-03:00 Christof Ressi christof.ressi@gmx.at:
just an idea: what if [seed( without argument would take the current system time?
or even seed it with the system time on creation?
Gesendet: Donnerstag, 31. Mai 2018 um 13:36 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list pd-list@lists.iem.at Betreff: Re: [PD] Random
- Marco Matteo Markidis mm.markidis@gmail.com [2018-05-30 19:29]:
usually in random number generators one wants to have control on the
seed
because this allows to have the same numeric streams every time one
wants.
I thought about this and conclude that the help patch should mention the fact that the sequence is always the same even when the object is not explicitely seeded with the [seed ...< message.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/
listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
you still have control on the seed... just seed it
no because you need to add an extra outlet to [random] and prints out the seed value.
or even seed it with the system time on creation?
if one adds now this behaviour one need to put a flag for backward compatibility.
what if [seed( without argument would take the current system time?
this could be an idea but one need the second outlet.
ciao -Marco Matteo Markidis
2018-05-31 17:50 GMT+02:00 Alexandre Torres Porres porres@gmail.com:
that's what I was suggesting ;)
2018-05-31 9:15 GMT-03:00 Christof Ressi christof.ressi@gmx.at:
just an idea: what if [seed( without argument would take the current system time?
or even seed it with the system time on creation?
Gesendet: Donnerstag, 31. Mai 2018 um 13:36 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list pd-list@lists.iem.at Betreff: Re: [PD] Random
- Marco Matteo Markidis mm.markidis@gmail.com [2018-05-30 19:29]:
usually in random number generators one wants to have control on the
seed
because this allows to have the same numeric streams every time one
wants.
I thought about this and conclude that the help patch should mention the fact that the sequence is always the same even when the object is not explicitely seeded with the [seed ...< message.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li
stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list