Text archives Help
- From: James Bigler <bigler@cs.utah.edu>
- To: "'manta@sci.utah.edu'" <manta@sci.utah.edu>
- Subject: [MANTA] new function in MT_RNG templated for Real
- Date: Fri, 10 Jun 2005 18:57:21 -0600
I added a new templated function for help when dealing with Real in the
code:
// Default to returning a double. In actuality this should never
// be used.
template<class T>
T genRealRand() { return static_cast<T>(gendrand()); }
// These are the specialized functions.
template<>
float MT_RNG::genRealRand<float>();
template<>
double MT_RNG::genRealRand<double>();
In the code you can use it like this without having to cast.
Real val = rng.genRealRand<Real>();
James
- [MANTA] new function in MT_RNG templated for Real, James Bigler, 06/10/2005
Archive powered by MHonArc 2.6.16.