Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

kapplication.h

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <sys/types.h>
00004 #include <sys/stat.h>
00005 #include <fcntl.h>
00006 #include <unistd.h>
00007 #include <time.h>
00008 
00009 static int _random() {
00010         static int init = false;
00011         if (!init) {
00012             unsigned int seed;
00013             init = true;
00014             int fd = ::open("/dev/urandom", O_RDONLY);
00015             if( fd<=0 || ::read(fd, &seed, sizeof(seed)) != sizeof(seed) ) {
00016                 srand(getpid());
00017                 seed = rand()+time(0);
00018             }
00019             if(fd>=0) close( fd );
00020             srand(seed);
00021         }
00022         return rand();
00023 }

Generated on Sat Nov 5 16:17:11 2005 for OPIE by  doxygen 1.4.2