]> git.itanic.dy.fi Git - sudoku/blobdiff - random.cpp
Return unsigned and initialize index
[sudoku] / random.cpp
index 62419c47fc7583d301fd140c679c7d787f89fe53..0585078fe6a0ad9678a7ed3d7649cf65143485ef 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,7 @@ int get_random(void)
 
                i += ret;
        } while (i < RAND_BUF_SIZE * sizeof(rndbuf[0]));
+       index = 0;
  out:
        close(fd);
 }