Hauptseite | Liste aller Namensbereiche | Klassenhierarchie | Alphabetische Liste | Datenstrukturen | Auflistung der Dateien | Datenstruktur-Elemente | Datei-Elemente

random.h

gehe zur Dokumentation dieser Datei
00001 /*
00002 Autor: $Author: kunkel $ State: $State: Exp $
00003 Datum: $Date: 2005/05/30 12:35:25 $
00004 Version: $Revision: 1.1 $
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     //skaliere auf bereich:
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 

Erzeugt am Mon May 30 14:31:15 2005 für Sunsystembuildingandsimulation von doxygen 1.3.6