C++ random class

I have a question about het the c++ random class. I have a program which has multiple class objects, each calls the rand() function from the c++ library. Does every object has its own sequence of random numbers or do they all descend from the same rand() class object? If the sequence is shared, is there a way to give each objects it's own sequence of random numbers?
Greetings,T
No.
If you need something like that, you'll have to either implement you own generator or use one from a third party. rand() can only be initialized or advanced.
Thanks!
is there a way to give each objects it's own sequence of random numbers?
What would be the difference between getting a number from a single sequence or from on of multiple sequences?
When simulating stochastic processes it is preferred to assign unique random sequences to parts of the simulation. With this e.g. it is possible to recreate parts of the simulation in exactly the same way, because of the same seed for that part, and then when modifying other parts of the simulating you can study differences cause by the changed part.
I see what you mean.

That would leave you with the problem of seeding the random number generators I suppose.
Just generate a series of random number with a specified seed and give each process a fixed number in the row of generated seeds.
Last edited on
Topic archived. No new replies allowed.