On 11/06/2012 07:14 PM, jerro wrote:
I was only talking about the part of initialization that doesn't use a RNG. I
agree that everything that uses a RNG should be done in opCall (or inside a
normal() function in the function interface). For Box-Muller, I think the
approach you currently use in NormalBoxMullerEngine is the most reasonable one.
But a Ziggurat engines needs to compute some tables before it can start
generating samples. It doesn't need a RNG to do that and the tables do not
change after initialization.

Ahh, OK, clear.  Then obviously your suggested approach is correct.

There's one change that I think would make the API more convenient. Normal
struct and the engine don't store an instance of a RNG , so they don't need to
take it as a template parameter. We could make opCall methods templates instead.
That way the users would never need to explicitly specify the type of the RNG.

I guess I was concerned about the possibility of a sequence of normal random numbers generated by a mix of different RNGs, but to be honest, if someone really, really wants to do that, I'm not sure I should stop them. :-)

Reply via email to