Main Page | Class Hierarchy | Class List | File List | Class Members

RandomSequence.h

00001 // RandomSequence.h -- The interface to a random number sequence.
00002 
00003 /*
00004  * Copyright (C) 2005 Tudor Hulubei <tudor@hulubei.net>.
00005  *
00006  * This library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 2, or (at
00009  * your option) any later version.
00010  *
00011  * This library 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 Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA,
00019  * 02111-1307, USA.
00020  */
00021 
00022 /*
00023  * NOTE: This is an interal header file.
00024  * You should not attempt to use it directly.
00025  */
00026 
00027 // $Id: RandomSequence_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
00028 
00029 #ifndef _CSP_KERNEL_RandomSequence_H
00030 #define _CSP_KERNEL_RandomSequence_H
00031 
00032 
00033 CSP_NAMESPACE_BEGIN(csp);
00034 
00035 
00048 class CSP_API RandomSequence
00049 {
00050   public:
00053     RandomSequence(Randomizer& randomizer);
00054 
00067     void setMode(bool predefined = false);
00068 
00071     unsigned int seed() const { return m_seed; }
00072 
00075     void setSeed(unsigned int seed) { m_seed = seed; }
00076 
00078     int next(int limit);
00079 
00080   private:
00082     RandomSequence(const RandomSequence&);
00083 
00085     RandomSequence& operator=(const RandomSequence&);
00086 
00088     Randomizer& m_randomizer;
00089 
00092     unsigned int m_seed;
00093 
00095     bool m_predefined;
00096 
00104     vector<pair<int, int> > m_sequence;
00105 
00108     size_t m_index;
00109 };
00110 
00111 
00112 CSP_NAMESPACE_END(csp);
00113 
00114 
00115 #endif // _CSP_KERNEL_RandomSequence_H
00116 
00117 // Local Variables:
00118 // mode: C++
00119 // End:

Generated on Wed May 25 12:21:15 2005 for csp.kdevelop by  doxygen 1.3.9.1