next up previous contents index
Next: 20.1.0.0.3 OTcl support Up: 20.1 Random Number Generation Previous: 20.1.0.0.1 C++ Support

20.1.0.0.2 Seeding the random number generator

When doing simulations often you will either want to get absolutely repeatable (deterministic) results or different results each time. Each approach requires a different seeding method.

To get deterministic behavior, invoke the []set_seed method with the first parameter either RAW_SEED_SOURCE or PREDEF_SEED_SOURCE. With a raw seed, the second parameter specifies the numeric seed that will be used (any integer). The alternative is predefined seeds, where the second selects seeds from a table of 64 known good seeds (which happen to be about 33 million steps apart in the default random number generation stream). Predefined seeds are know to provide a good random number stream, but there are limited numbers of them. Raw seeds may not provide a statistically good random number stream but are easy to generate.

To get non-deterministic behavior, pick a seed with either RAW_SEED_SOURCE or HEURISTIC_SEED_SOURCE. For raw streams the second argument specifies the stream. For heuristic streams the second argument is ignored and a seed is generated based on the current time of day and a counter. Both have the caveat that they may not provide a statistically good random number stream. It is very unlikely that any two heuristic seeds will be identical.


next up previous contents index
Next: 20.1.0.0.3 OTcl support Up: 20.1 Random Number Generation Previous: 20.1.0.0.1 C++ Support

2000-08-24