Alex Rivera | Logout

Deterministic Random Number Streams in C++ STL

Asked 2009-03-16T19:32:06.497
10

I want to supply a number, and then receive a set of random numbers. However, I want those numbers to be the same regardless of which computer I run it on (assuming I supply the same seed).

Basically my question is: in C++, if I make use of rand(), but supply srand() with a user-defined seed rather than the current time, will I be able to generate the same random number stream on any computer?

Edit
Report

1 Answer

0

I believe if you supply with srand with the same seed, you will get the same results. That's pretty much the definition of a seed in terms of pseudo random number generators.

answered 2009-03-16T19:34:22.230

Your Answer