different random number stream for different functions

Mar 4, 2014 at 11:29pm
Hi all,

I am wondering is there a way to make function A uses random number stream say starting from srand(1) and function B uses random number stream say starting from srand(2) in the same program.

Thanks
Mar 4, 2014 at 11:51pm
rand() is going to be deprecated soon for this exact reason.

http://en.cppreference.com/w/cpp/numeric/random
^ random number generators are independent objects with their own states
Last edited on Mar 4, 2014 at 11:51pm
Mar 5, 2014 at 2:41am
I am pretty new at this. Which one am I suppose to be looking at in that link?


Thanks
Mar 5, 2014 at 3:36am
You should be looking at all of them to decide which one you think is best for your situation. For example, in most cases the Mersenne twister algorithm is good enough, but that depends on your situation.
Topic archived. No new replies allowed.