[BACK]Return to run.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / awk

Diff for /src/usr.bin/awk/run.c between version 1.23 and 1.24

version 1.23, 2003/08/06 21:08:07 version 1.24, 2004/05/08 22:08:51
Line 64 
Line 64 
 #endif  #endif
   
 jmp_buf env;  jmp_buf env;
   int use_arc4 = 1;
 extern  int     pairstack[];  extern  int     pairstack[];
   
 Node    *winner = NULL; /* root of parse tree */  Node    *winner = NULL; /* root of parse tree */
Line 1501 
Line 1502 
                 u = (Awkfloat) system(getsval(x)) / 256;   /* 256 is unix-dep */                  u = (Awkfloat) system(getsval(x)) / 256;   /* 256 is unix-dep */
                 break;                  break;
         case FRAND:          case FRAND:
                 /* in principle, rand() returns something in 0..RAND_MAX */                  if (use_arc4)
                 u = (Awkfloat) (rand() % RAND_MAX) / RAND_MAX;                          u = (Awkfloat) (arc4random() % RAND_MAX) / RAND_MAX;
                   else
                           u = (Awkfloat) (random() % RAND_MAX) / RAND_MAX;
                 break;                  break;
         case FSRAND:          case FSRAND:
                 if (isrec(x))   /* no argument provided */                  if (isrec(x))   /* no argument provided, want arc4random() */
                         u = time((time_t *)0);                          use_arc4 = 1;
                 else                  else {
                         u = getfval(x);                          u = getfval(x);
                 srand((unsigned int) u);                          srandom((unsigned int) u);
                           use_arc4 = 0;
                   }
                 break;                  break;
         case FTOUPPER:          case FTOUPPER:
         case FTOLOWER:          case FTOLOWER:

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24