1 | /* This file is part of the KDE libraries |
2 | Copyright (c) 1999 Matthias Kalle Dalheimer <kalle@kde.org> |
3 | Copyright (c) 2000 Charles Samuels <charles@kde.org> |
4 | Copyright (c) 2005 Joseph Wenninger <kde@jowenn.at> |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef KRANDOM_H |
23 | #define KRANDOM_H |
24 | |
25 | #include <kdecore_export.h> |
26 | |
27 | #include <QtCore/QString> |
28 | |
29 | /** |
30 | * \headerfile krandom.h <KRandom> |
31 | * |
32 | * @short Helper class to create random data |
33 | * |
34 | * This namespace provides methods which generate random data. |
35 | */ |
36 | namespace KRandom { |
37 | /** |
38 | * Generates a uniform random number. |
39 | * @return A random number in the range [0, RAND_MAX). The RNG is seeded |
40 | * on first use. |
41 | */ |
42 | KDECORE_EXPORT int random(); |
43 | |
44 | /** |
45 | * Generates a random string. It operates in the range [A-Za-z0-9] |
46 | * @param length Generate a string of this length. |
47 | * @return the random string |
48 | */ |
49 | KDECORE_EXPORT QString randomString(int length); |
50 | } |
51 | |
52 | |
53 | #endif |
54 | |
55 | |