Logo
~Sockets~
~Examples~
~Contact~


RandomNumber.h

Go to the documentation of this file.
00001 
00005 /*
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 */
00020 
00021 #ifndef _SOCKET_RandomNumber_H
00022 #define _SOCKET_RandomNumber_H
00023 
00024 #include "sockets-config.h"
00025 #include <limits>
00026 
00027 #ifdef SOCKETS_NAMESPACE
00028 namespace SOCKETS_NAMESPACE {
00029 #endif
00030 
00040 class RandomNumber
00041 {
00042 
00043 public:
00049   RandomNumber(bool time_shuffle = false);
00050 
00062   RandomNumber(
00063     unsigned long int x_seed,
00064     unsigned long int y_seed,
00065     unsigned long int z_seed,
00066     unsigned long int w_seed);
00067 
00071   ~RandomNumber();
00072 
00073   // public methods
00074 
00078   void reset();
00079 
00085   operator unsigned long int() const;
00086 
00095   unsigned long int next();
00096 
00104   unsigned long int skip(unsigned long int s);
00105 
00117   void getSeed(
00118     unsigned long int& x_seed,
00119     unsigned long int& y_seed,
00120     unsigned long int& z_seed,
00121     unsigned long int& w_seed);
00122 
00128   static unsigned long int max_random();
00129 
00130   // public constants
00131 
00135   static const unsigned long int X_SEED_DEFAULT;
00136 
00140   static const unsigned long int Y_SEED_DEFAULT;
00141 
00145   static const unsigned long int Z_SEED_DEFAULT;
00146 
00150   static const unsigned long int W_SEED_DEFAULT;
00151 
00152 private:
00156   unsigned long int mXSeed;
00157 
00161   unsigned long int mYSeed;
00162 
00166   unsigned long int mZSeed;
00167 
00171   unsigned long int mWSeed;
00172 
00176   unsigned long int mX;
00177 
00181   unsigned long int mY;
00182 
00186   unsigned long int mZ;
00187 
00193   unsigned long int mW;
00194 
00195 };
00196 
00197 #ifdef SOCKETS_NAMESPACE
00198 } // namespace SOCKETS_NAMESPACE {
00199 #endif
00200 
00201 #endif // _SOCKETS_RandomNumber_H
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4