-rw-r--r-- | microkde/kapplication.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp new file mode 100644 index 0000000..a1d00a8 --- a/dev/null +++ b/microkde/kapplication.cpp | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <stdlib.h> | ||
2 | |||
3 | #include "kapplication.h" | ||
4 | |||
5 | int KApplication::random() | ||
6 | { | ||
7 | return rand(); | ||
8 | } | ||
9 | |||
10 | //US | ||
11 | QString KApplication::randomString(int length) | ||
12 | { | ||
13 | if (length <=0 ) return QString::null; | ||
14 | |||
15 | QString str; | ||
16 | while (length--) | ||
17 | { | ||
18 | int r=random() % 62; | ||
19 | r+=48; | ||
20 | if (r>57) r+=7; | ||
21 | if (r>90) r+=6; | ||
22 | str += char(r); | ||
23 | // so what if I work backwards? | ||
24 | } | ||
25 | return str; | ||
26 | } | ||