00001 /********************************************************************** 00002 GSRandom -- A singleton randomnumber generator 00003 00004 Copyright (C) 2010-2011 by David C. Lonie 00005 00006 This source code is released under the New BSD License, (the "License"). 00007 00008 Unless required by applicable law or agreed to in writing, software 00009 distributed under the License is distributed on an "AS IS" BASIS, 00010 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00011 See the License for the specific language governing permissions and 00012 limitations under the License. 00013 ***********************************************************************/ 00014 00015 #ifndef GLOBALSEARCHRANDOM_H 00016 #define GLOBALSEARCHRANDOM_H 00017 00018 namespace GlobalSearch { 00019 00032 class GSRandom 00033 { 00034 public: 00036 static GSRandom* instance(); 00037 00039 double getRandomDouble(); 00041 unsigned int getRandomUInt(); 00042 00043 protected: 00045 GSRandom(); 00047 GSRandom(const GSRandom&) {}; 00049 GSRandom& operator= (const GSRandom&) {}; 00050 private: 00052 static GSRandom* m_instance; 00054 bool m_seedLock; 00055 }; 00056 } 00057 00058 #endif