Generating random numbers in SOUL

I have just started looking at SOUL but just can’t figure out how to get different seeds into an array of processors as the usual trick of taking the system clock isn’t available. I am trying to set up random detuning stuff.
What am I missing?


I didn’t test but perhaps each of your processor could have a setSeed() function, with something like that more or less ?

processor RandomProcessor
    random::RandomNumberState state;

    void setSeed (int seed)
        state = random::RandomNumberState (seed);

   float nextFloat()
        return random::getNextBipolar (state);

Thanks for raising this - I forgot to add a note about this in the language guide, I’ll do that now.

There are a couple of constants you can use: processor.session is a unique number that changes each time a new run starts, and is a unique number for each instance of a processor.

Using means that a set of processors can all seed their RNGs differently, and if you also use processor.session then each run will also be different (although that’s probably not so important in practice)


Brilliant! Just what I need. Thanks.