BZDEV: blitz random design

From: nbecker@fred.net
Date: Tue Nov 21 2000 - 08:44:30 EST


I'm pleased to see that blitz includes an assortment of random generation.

I have one suggestion regarding the design. I believe it is
preferrable to pass the base random number generator (RNG),
eg. twister in the call to the member function random, rather than
having the RNG be a member of the class.

For example:

class Normal {
  double std;
template<typename RNG>
double random (RNG r);
};

This has two benefits. Generally, I think it offers more flexibility
if the commitment to use particular objects is deferred as late as
possible. Secondly, the mechanism to use a shared or non-shared RNG
is simplified. While blitz has a mechanism to do this, I believe a
good argument could be made that this is a lot simpler. Third, if you
need to coordinate sharing a RNG with a class that is not part of
blitz, this method is again simple.

--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/blitz/lists.html



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:12 EST