There're no random numbers used within the physics sim, but I'm assuming you're using the physics with randomly created particle positions and use
Vec2D/3D.randomVector() or
jitter() (the latter is actually used by AttractionBehavior). Since toxiclibs knows nothing about Processing you're right that setting
randomSeed() in P5 doesn't have any impact.
Due to the design of Processing there's also no way to obtain a direct reference to P5's internal random generator (
it only is visible within the processing.core package, maybe submit a ticket to change that), however you can configure the toxiclibs default instance in several ways:
- import toxi.math.*;
- // just seed the default generator
- MathUtils.RND.setSeed(23);
- // or actually use an external generator as the default within toxiclibs
- // all classes which use random numbers will make use of this default generator:
- // e.g. Vec2D.randomVector(), TColor.newRandom(), FloatRange.pickRandom() etc.
- Random rnd=new Random(23);
- MathUtils.setDefaultRandomGenerator(rnd);
The latter option is useful for plugging in faster and/or qualitative better options than the default Java Random implementation, e.g. the famous
Mersenne Twister...
Once you've seeded that default generator, it will also deliver the ever same results.