• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

krandomsequence.h

Go to the documentation of this file.
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 <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

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal