KDECore
krandomsequence.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef K_RANDOM_SEQUENCE_H
00019 #define K_RANDOM_SEQUENCE_H
00020
00021 #include <kdecore_export.h>
00022 #include <QtCore/QList>
00023
00040 class KDECORE_EXPORT KRandomSequence
00041 {
00042 public:
00056 explicit KRandomSequence( long lngSeed = 0 );
00057
00061 virtual ~KRandomSequence();
00062
00066 KRandomSequence(const KRandomSequence &a);
00067
00071 KRandomSequence &operator=(const KRandomSequence &a);
00072
00079 void setSeed( long lngSeed = 0 );
00080
00086 double getDouble();
00087
00094 unsigned long getLong(unsigned long max);
00095
00101 bool getBool();
00102
00109 template<typename T> void randomize(QList<T>& list) {
00110 QList<T> l;
00111
00112 l.append(list.takeFirst());
00113 while (list.count())
00114 l.insert(int(getLong(l.count()+1)), list.takeFirst());
00115 list = l;
00116 }
00117
00118
00140 void modulate(int i);
00141
00142 private:
00143 class Private;
00144 Private *const d;
00145 };
00146
00147 #endif