]> git.itanic.dy.fi Git - sudoku/commitdiff
Return unsigned and initialize index
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 20 Jun 2009 09:47:06 +0000 (12:47 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 20 Jun 2009 09:47:06 +0000 (12:47 +0300)
random.cpp
random.h

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);
 }
index f9c92c0e534b6ff79fc2e837f62901a25b29a1c9..89507af1f6fa848273515dcf652e677c186564ef 100644 (file)
--- a/random.h
+++ b/random.h
@@ -1,6 +1,6 @@
 #ifndef _RANDOM_H
 #define _RANDOM_H
 
-int get_random(void);
+unsigned int get_random(void);
 
 #endif