Changeset 3097 in Sophya for trunk/SophyaLib/NTools/perandom.h


Ignore:
Timestamp:
Oct 16, 2006, 7:17:55 PM (19 years ago)
Author:
cmv
Message:

precisions sur ComplexGaussRan cmv 16/10/2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/perandom.h

    r3075 r3097  
    99#include "machdefs.h"
    1010#include <stdlib.h>
     11#include <math.h>
    1112#include "histos.h"
    1213#include "srandgen.h"
     
    4243};
    4344
    44 //!  Returns a random gaussian complex number with variance sig^2
     45//! Returns a random complex number such that real and imaginary parts are gaussians with variance sig^2
    4546inline complex< r_8 > ComplexGaussRan(double sig=1.)
    4647  {return complex< r_8 >(GauRnd(0.,sig),GauRnd(0.,sig));}
     48
     49//! Returns the module of a random complex number generated by ComplexGaussRan
     50inline double ModComplexGaussRan(double sig=1.)
     51  {double r=-log(1.-drand01()); return sig*sqrt(2.*r);}
    4752
    4853} // namespace SOPHYA
Note: See TracChangeset for help on using the changeset viewer.