Last change
on this file since 66 was
66,
checked in by Maciej Komosinski, 14 years ago
|
set 'eol-style' to 'native'
|
-
Property svn:eol-style set to
native
|
File size:
874 bytes
|
Rev | Line | |
---|
[66] | 1 | #ifndef _RNDUTIL_H_ |
---|
| 2 | #define _RNDUTIL_H_ |
---|
| 3 | |
---|
| 4 | #include "nonstd.h" |
---|
| 5 | #include "math.h" |
---|
| 6 | |
---|
| 7 | /** @file rndutil.h various functions */ |
---|
| 8 | |
---|
| 9 | /** @param x change seed if x<=0 |
---|
| 10 | @return random value [0..x-1] if x>0 */ |
---|
| 11 | unsigned short pseudornd(short x); |
---|
| 12 | |
---|
| 13 | double CustomRnd(double*); |
---|
| 14 | // the parameter is a table which describes the random distribution: |
---|
| 15 | // e.g. |
---|
| 16 | // double x[]={ 3, // 3 intervals |
---|
| 17 | // -10,-1, // (each of them has always uniform distribution and equal probability of being selected) |
---|
| 18 | // -1, 1, |
---|
| 19 | // 1,10, }; |
---|
| 20 | |
---|
| 21 | class RandomGener |
---|
| 22 | { |
---|
| 23 | public: |
---|
| 24 | RandomGener() {isNextGauss=0;} |
---|
| 25 | static double Uni(float pocz, float kon); ///< unform excluding boundaries |
---|
| 26 | double GaussStd(); |
---|
| 27 | double Gauss(float m,float s); ///< usually will not return further than 5*stdd |
---|
| 28 | private: |
---|
| 29 | int isNextGauss; |
---|
| 30 | double nextGauss; |
---|
| 31 | }; |
---|
| 32 | |
---|
| 33 | extern RandomGener RndGen; |
---|
| 34 | |
---|
| 35 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.