#include <newran.h>
Inheritance diagram for Random:
Public Member Functions | |
double | Get () |
virtual Real | Next () |
virtual char * | Name () |
virtual Real | Density (Real) const |
Random () | |
virtual | ~Random () |
SelectedRandom & | operator() (double) |
RepeatedRandom & | operator() (int) |
virtual ExtReal | Mean () const |
virtual ExtReal | Variance () const |
virtual void | tDelete () |
virtual int | nelems () const |
virtual void | load (int *, Real *, Random **) |
virtual Random * | Getrv (void) |
Static Public Member Functions | |
void | Set (double s) |
Private Member Functions | |
Real | Raw () |
void | operator= (const Random &) |
Private Attributes | |
Real | Buffer [128] |
Static Private Attributes | |
double | seed |
Friends | |
class | RandomPermutation |
|
Definition at line 168 of file newran.cpp.
|
|
Definition at line 45 of file newran.h.
00045 {} // make destructors virtual
|
|
Reimplemented in Poisson1, Gamma1, Gamma2, Binomial1, Uniform, Normal, Cauchy, Exponential, PosGenX, SymGenX, AsymGenX, and NegativeBinomial. Definition at line 144 of file newran.cpp. References Real. Referenced by AsymGen::Build(), PosGen::Build(), AsymGen::Next(), SymGen::Next(), and PosGen::Next().
00145 { Throw(Logic_error("density function not defined")); return 0.0; } |
|
Definition at line 165 of file newran.cpp. References seed.
00166 { return seed/2147483648L; } |
|
Reimplemented in NegatedRandom. Definition at line 58 of file newran.h.
00058 { return 0; }
|
|
Reimplemented in SelectedRandom, and AddedSelectedRandom. Definition at line 794 of file newran.cpp. Referenced by AddedSelectedRandom::load().
00795 { Throw(Logic_error("Newran: illegal combination")); } |
|
Reimplemented in ChiSq1, Poisson1, Poisson2, Gamma1, Gamma2, Binomial1, Binomial2, Uniform, Constant, PosGen, Normal, ChiSq, Cauchy, Exponential, AsymGen, Gamma, Pareto, DiscreteGen, Poisson, Binomial, NegativeBinomial, NegatedRandom, ScaledRandom, ReciprocalRandom, ShiftedRandom, ReverseShiftedRandom, RepeatedRandom, MultipliedRandom, AddedRandom, OredRandom, SubtractedRandom, DividedRandom, SumRandom, MixedRandom, and OredVectRandom. Definition at line 48 of file newran.h. Referenced by alHistogram(), MultipliedRandom::Mean(), SubtractedRandom::Mean(), OredRandom::Mean(), AddedRandom::Mean(), RepeatedRandom::Mean(), ReverseShiftedRandom::Mean(), ShiftedRandom::Mean(), ScaledRandom::Mean(), NegatedRandom::Mean(), and MultipliedRandom::Variance().
00048 { return 0.5; }
|
|
Reimplemented in Uniform, Constant, PosGen, SymGen, Normal, ChiSq, Cauchy, Exponential, AsymGen, Gamma, PosGenX, SymGenX, AsymGenX, Pareto, DiscreteGen, Poisson, Binomial, NegativeBinomial, SumRandom, and MixedRandom. Definition at line 902 of file newran.cpp. Referenced by alHistogram().
00902 { return "Random"; } |
|
Reimplemented in AddedSelectedRandom. Definition at line 53 of file newran.h. Referenced by AddedSelectedRandom::nelems().
00053 { return 1; }
|
|
|
Definition at line 661 of file newran.cpp. References ErrorNoSpace().
00662 { 00663 RepeatedRandom* r = new RepeatedRandom(*this, n); 00664 if (!r) ErrorNoSpace(); return *r; 00665 } |
|
Definition at line 891 of file newran.cpp. References ErrorNoSpace().
00892 { 00893 SelectedRandom* r = new SelectedRandom(*this, p); 00894 if (!r) ErrorNoSpace(); return *r; 00895 } |
|
Definition at line 36 of file newran.h.
00036 {} // private so can't access
|
|
Definition at line 132 of file newran.cpp. Referenced by Next(), and Random().
00133 { 00134 // m = 2147483647 = 2^31 - 1; a = 16807; 00135 // 127773 = m div a; 2836 = m mod a 00136 long iseed = (long)seed; 00137 long hi = iseed / 127773L; // integer division 00138 long lo = iseed - hi * 127773L; // modulo 00139 iseed = 16807 * lo - 2836 * hi; 00140 if (iseed <= 0) iseed += 2147483647L; 00141 seed = (double)iseed; return seed*4.656612875e-10; 00142 } |
|
Definition at line 174 of file newran.cpp. References seed. Referenced by main(), and Parameters::Parameters().
00176 { 00177 if (s>=1.0 || s<=0.0) 00178 Throw(Logic_error("Newran: seed out of range")); 00179 //iseed = 2147483648L * s; // for Mother 00180 seed = (long)(s*2147483648L); 00181 } |
|
Reimplemented in NegatedRandom, ScaledRandom, ReciprocalRandom, RepeatedRandom, MultipliedRandom, SelectedRandom, and AddedSelectedRandom. Definition at line 52 of file newran.h. Referenced by MixedRandom::~MixedRandom().
00052 {} // delete components of sum
|
|
Reimplemented in ChiSq1, Poisson1, Poisson2, Gamma1, Gamma2, Binomial1, Binomial2, Uniform, Constant, PosGen, Normal, ChiSq, Cauchy, Exponential, AsymGen, Gamma, Pareto, DiscreteGen, Poisson, Binomial, NegativeBinomial, NegatedRandom, ScaledRandom, ReciprocalRandom, ShiftedRandom, ReverseShiftedRandom, RepeatedRandom, MultipliedRandom, AddedRandom, OredRandom, SubtractedRandom, DividedRandom, SumRandom, MixedRandom, and OredVectRandom. Definition at line 50 of file newran.h. Referenced by alHistogram(), MultipliedRandom::Variance(), SubtractedRandom::Variance(), OredRandom::Variance(), AddedRandom::Variance(), RepeatedRandom::Variance(), ReverseShiftedRandom::Variance(), ShiftedRandom::Variance(), ScaledRandom::Variance(), and NegatedRandom::Variance().
00050 { return 1.0/12.0; }
|
|
|
|
|
|
Definition at line 114 of file newran.cpp. |