Changeset 3097 in Sophya for trunk/SophyaLib/NTools/perandom.h
- Timestamp:
- Oct 16, 2006, 7:17:55 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/perandom.h
r3075 r3097 9 9 #include "machdefs.h" 10 10 #include <stdlib.h> 11 #include <math.h> 11 12 #include "histos.h" 12 13 #include "srandgen.h" … … 42 43 }; 43 44 44 //! Returns a random gaussian complex numberwith variance sig^245 //! Returns a random complex number such that real and imaginary parts are gaussians with variance sig^2 45 46 inline complex< r_8 > ComplexGaussRan(double sig=1.) 46 47 {return complex< r_8 >(GauRnd(0.,sig),GauRnd(0.,sig));} 48 49 //! Returns the module of a random complex number generated by ComplexGaussRan 50 inline double ModComplexGaussRan(double sig=1.) 51 {double r=-log(1.-drand01()); return sig*sqrt(2.*r);} 47 52 48 53 } // namespace SOPHYA
Note:
See TracChangeset
for help on using the changeset viewer.