Random: exponential_dsitribution requires a [0, 1) engine?

1 Jun
2006
1 Jun
'06
11:07 a.m.
Maybe I'm missing something, but the implementation of the exponential dsitribution looks like this: template<class Engine> result_type operator()(Engine& eng) { return -result_type(1) / _lambda * log(result_type(1)-eng()); } That seems to assume that the Engine has a rane of [0, 1). Certainly if I pass it in (say) a mt19937 engine it goes rather badly wrong, attempting to take the log of a large negative number. But the documentation contains no such requirement - it merely says it needs a UniformRandomNumberGenerator, which explicitly allows for any range. - Alan
6949
Age (days ago)
6949
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alan Stokes