00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) University of Illinois and Steven M. LaValle. 00006 // All Rights Reserved. 00007 // 00008 // Permission to use, copy, and distribute this software and its 00009 // documentation is hereby granted free of charge, provided that 00010 // (1) it is not a component of a commercial product, and 00011 // (2) this notice appears in all copies of the software and 00012 // related documentation. 00013 // 00014 // The University of Illinois and the author make no representations 00015 // about the suitability or fitness of this software for any purpose. 00016 // It is provided "as is" without express or implied warranty. 00017 //---------------------------------------------------------------------- 00018 00019 #include "MTRand.h" 00020 00021 #ifndef MSL_RANDOM_H 00022 #define MSL_RANDOM_H 00023 00024 class MSLRandomSource { 00025 00026 public: 00027 00028 typedef unsigned long uint32; // unsigned integer type, at least 32 bits 00029 //put in for use with MTRand class 00030 00031 MSLRandomSource(); 00032 MSLRandomSource(int a); 00033 00034 double getUniform(); 00035 double getGaussian(double mean, double variance); 00036 int getRangedInt(int low, int high); 00037 double getRangedDouble(double low, double high); 00038 float getRangedFloat(float low, float high); 00039 00040 MSLRandomSource& operator>>(double& x); 00041 MSLRandomSource& operator>>(float& x); 00042 00043 private: 00044 00045 MTRand *mtr; 00046 00047 }; 00048 00049 #endif