[Insight-users] Typo in MersenneTwisterRandomVariateGenerator?

Gheorghe Postelnicu gheorghe.postelnicu at gmail.com
Thu Oct 26 12:41:41 EDT 2006


Hi,

I am trying to use MersenneTwisterRandomVariateGenerator, namely the
method GetVariateWithClosedRange, but the result was above the given
range. The code actually uses the STL(or other) rand() funciton. Is
this normal?


/** Get a random variate in the range [0, n] */
inline double
  MersenneTwisterRandomVariateGenerator::GetVariateWithClosedRange(
                                                    const double& n )
  {
  return rand() * n;
  }

Thanks,
-- 
Gheorghe Postelnicu, PhD
MGH, Harvard Medical School


More information about the Insight-users mailing list