00001
00002
00003
00004
00005
00006
00011 #ifndef RANDOM_H
00012 #define RANDOM_H
00013
00014 #include <math.h>
00015
00022 inline double drand(double min, double max) {
00023 double bereich=max-min;
00024
00025 return double(random()) / RAND_MAX * bereich+min;
00026 }
00027
00037 inline double potenzRand(int potMin,int potMax, bool isPossibleNegativ=false) {
00038 int potenz = random() % (potMax-potMin+1);
00039
00040 double sign=1.0;
00041 if(isPossibleNegativ && random() % 2 ==1)
00042 sign = -1.0;
00043
00044 return sign * double(random()) / RAND_MAX * pow(10.0,potenz+potMin);
00045 }
00046
00047 #endif
00048