On Tuesday 26 January 2010 00:01:50 Gabriel M. Beddingfield wrote:
On Tue, 26 Jan 2010, cal wrote:
That is
to say, if you need a reproduceable string of "random" numbers
on each thread (e.g. for unit testing), then random_r() is your man.
Otherwise, it sounds like more trouble than it's worth.
As I understand it, zyn wants a reproducible sequence for mainstream,
plus a reproducible per note sequence seeded according to the current
point in the mainstream sequence. Interrupting and resuming the
mainstream sequence was the issue I was looking to simplify. If you step
over srandom_r(), it's really not any great trouble.
Kind of like where the random number generator is part of
the envelope, huh? That makes sense... in which case
random_r() would be a good use for that.
I don't (yet) get the reason for doing this. If the global seed is initiated
with time() it is the same as if each notes seed is initiated with time(), the
numbers are still random beginning from that seed. The only problems I can see
is when the random numbers are correlated resulting with per-note correlation
of for example always the a of the adsr being to short. A problem that is
easily solved when multiple notes get their numbers from the same seed
effectively randomizing the access to that seed and thus overcoming the
correlation...
Arnold