* Currently we can't switch to SeqRandom mode from other mode, * because we need a way to specify sequence numbers anyway. */
| 106 | * because we need a way to specify sequence numbers anyway. |
| 107 | */ |
| 108 | RNDNUM_GENERATOR |
| 109 | RandomNumber::SwitchRndNumGenerator(RNDNUM_GENERATOR rImpl) |
| 110 | { |
| 111 | unsigned int count = AbsRndNumGenerator::count(); |
| 112 | AbsRndNumGenerator *generator = instance_->generators_[rImpl]; |
| 113 | if (generator == NULL) { |
| 114 | generator = AbsRndNumGenerator::make_rndnum_generator(rImpl, instance_->seed_); |
| 115 | assert(generator); |
| 116 | instance_->generators_[rImpl] = generator; |
| 117 | } |
| 118 | |
| 119 | RNDNUM_GENERATOR old = instance_->curr_generator_->kind(); |
| 120 | assert(static_cast<unsigned int>(old) < count); |
| 121 | |
| 122 | instance_->curr_generator_ = generator; |
| 123 | return old; |
| 124 | } |
| 125 | |
| 126 | std::string |
| 127 | RandomNumber::get_prefixed_name(const std::string &name) |