Fixing #100 : 31 bit random number generator with static seed (Android)
authorEdouard Tisserant
Mon, 11 Jul 2016 18:11:36 +0200
changeset 83870119c10b0f5
parent 833 e9ee49d7ab5a
child 839 d2740d2c67b3
Fixing #100 : 31 bit random number generator with static seed (Android)
src/platform_unix.c
     1.1 --- a/src/platform_unix.c	Mon Jul 11 15:48:19 2016 +0200
     1.2 +++ b/src/platform_unix.c	Mon Jul 11 18:11:36 2016 +0200
     1.3 @@ -52,7 +52,12 @@
     1.4  
     1.5  long int random(void)
     1.6  {
     1.7 -    static unsigned short xsubi[3] = {'p', 'E', 'p'};
     1.8 +    time_t t = time(NULL);
     1.9 +    static unsigned short xsubi[3];
    1.10 +    xsubi[0] = ((unsigned short *)t)[0];
    1.11 +    xsubi[1] = ((unsigned short *)t)[1];
    1.12 +    xsubi[2] = ((unsigned short *)t)[2];
    1.13 +
    1.14      return nrand48(xsubi);
    1.15  }
    1.16