[PD] help_random/seed

IOhannes m zmoelnig zmoelnig at iem.at
Mon Jul 6 13:27:36 CEST 2009

Andrew Faraday wrote:
> I'm fairly sure that [snapshot~] doesn't generate random numbers, but marks the current point of an audio signal. 


> Although this whole thing's got me thinking...
> If you use [snapshot~], attached to a real world sound source [adc~] to generate random numbers, then increasing volume would increase the range of your random generation. For instance 
> [adc~]|[snapshot~] (plus a bang)|[+ 1]|[* 10]|[int]

first of all: [adc~] is _not_ a random number generator.
it is an interface to the outside world. whatever is attached to your 
soundcard (or whatever feeds [adc~] will determine what comes out of 

e.g. if i connect [adc~] to [dac~] then i might hear whatever is 
recorded by my built-in microphone. i would not consider this "noise" in 
the strict mathematical sense.

if you connect an analog noise generator to your soundcard, then you 
might get a nice (and truely random, though coloured) noise.

now a real-world analog-digital converter always produces a (hopefully 
small) bit of thermal nose, which can be used as either a noise-source 
by itself (but take care, if you speak into the microphone...) or as a 
truely-random seed generator for a pseudo-random number generator.

the latter might give more what you would expect.

the former has (apart from the "microphone" problem) the drawback, that 
it will only generate a single "random" number per audio-block (or to be 
precise: 64 for of them); which might be just too few for your 

> In this case a sound source at a solid 1 - -1 volume (such as [osc~]) would give you a number from 0 to 20, when the bang is sent.
> but a quieter sound source e.g. 0.2 - -0.2 would provide a number from 0 - 4
> Anyone fault my logic?

simple primary school mathematics?
([-1..1] + 1)*10 = [0..2]*10 = [0..20]
([-0.2..0.2] + 1)*10 = [0.8..1.2]*10 = [8..12]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3636 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090706/9fb421a5/attachment.bin>

More information about the Pd-list mailing list