]> git.itanic.dy.fi Git - sudoku/blobdiff - random.cpp
random.cpp: Return better random numbers
[sudoku] / random.cpp
index 62419c47fc7583d301fd140c679c7d787f89fe53..f59b0cfcf50365b655cc5ccc66a99e42252162ee 100644 (file)
@@ -11,7 +11,7 @@
 #define RAND_BUF_SIZE  1024
 #define RND_DEV                "/dev/urandom"
 
-int get_random(void)
+unsigned int get_random(void)
 {
        static int rndbuf[RAND_BUF_SIZE];
        static int index = RAND_BUF_SIZE;
@@ -41,6 +41,8 @@ int get_random(void)
 
                i += ret;
        } while (i < RAND_BUF_SIZE * sizeof(rndbuf[0]));
+       index = 0;
  out:
+       return get_random();
        close(fd);
 }