summaryrefslogtreecommitdiff
path: root/noncore/games/zsame/dropin/kapplication.h
authorzecke <zecke>2004-02-17 15:55:24 (UTC)
committer zecke <zecke>2004-02-17 15:55:24 (UTC)
commit1207607ebbc59841718b79508fc222cb4eee9fde (patch) (side-by-side diff)
tree60c292a98621385006fbacca82dd11326765c0ab /noncore/games/zsame/dropin/kapplication.h
parent2ec4085cc290a212c7bec8bdf7a2475f3ee6e069 (diff)
downloadopie-1207607ebbc59841718b79508fc222cb4eee9fde.zip
opie-1207607ebbc59841718b79508fc222cb4eee9fde.tar.gz
opie-1207607ebbc59841718b79508fc222cb4eee9fde.tar.bz2
Add the source of zsame
Diffstat (limited to 'noncore/games/zsame/dropin/kapplication.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/zsame/dropin/kapplication.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/noncore/games/zsame/dropin/kapplication.h b/noncore/games/zsame/dropin/kapplication.h
new file mode 100644
index 0000000..f83d08e
--- a/dev/null
+++ b/noncore/games/zsame/dropin/kapplication.h
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <time.h>
+
+static int _random() {
+ static int init = false;
+ if (!init) {
+ unsigned int seed;
+ init = true;
+ int fd = ::open("/dev/urandom", O_RDONLY);
+ if( fd<=0 || ::read(fd, &seed, sizeof(seed)) != sizeof(seed) ) {
+ srand(getpid());
+ seed = rand()+time(0);
+ }
+ if(fd>=0) close( fd );
+ srand(seed);
+ }
+ return rand();
+}