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)