krandomsequence.h
00001 /* This file is part of the KDE libraries 00002 Copyright (c) 1999 Sean Harmer <sh@astro.keele.ac.uk> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef K_RANDOM_SEQUENCE_H 00019 #define K_RANDOM_SEQUENCE_H 00020 00021 #include "kdelibs_export.h" 00022 00023 class KRandomSequencePrivate; 00024 class QGList; 00039 class KDECORE_EXPORT KRandomSequence 00040 { 00041 public: 00055 KRandomSequence( long lngSeed = 0 ); 00056 00060 virtual ~KRandomSequence(); 00061 00065 KRandomSequence(const KRandomSequence &a); 00066 00070 KRandomSequence &operator=(const KRandomSequence &a); 00071 00078 void setSeed( long lngSeed = 0 ); 00079 00085 double getDouble(); 00086 00093 unsigned long getLong(unsigned long max); 00094 00100 bool getBool(); 00101 00107 void randomize(QGList *list); 00108 00130 void modulate(int i); 00131 00132 private: 00133 void Draw(); // Generate the random number 00134 long m_lngSeed1; 00135 long m_lngSeed2; 00136 long m_lngShufflePos; 00137 00138 static const int m_nShuffleTableSize; 00139 long *m_ShuffleArray; 00140 00141 KRandomSequencePrivate *d; 00142 }; 00143 00144 #endif 00145