=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/run.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- src/usr.bin/awk/run.c 2011/09/28 19:27:18 1.33 +++ src/usr.bin/awk/run.c 2013/09/29 15:42:25 1.34 @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.33 2011/09/28 19:27:18 millert Exp $ */ +/* $OpenBSD: run.c,v 1.34 2013/09/29 15:42:25 deraadt Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -66,7 +66,7 @@ /* #endif */ jmp_buf env; -int use_arc4 = 1; +int use_srandom; extern int pairstack[]; extern Awkfloat srand_seed; @@ -1582,16 +1582,16 @@ u = (Awkfloat) system(getsval(x)) / 256; /* 256 is unix-dep */ break; case FRAND: - if (use_arc4) - u = (Awkfloat)arc4random() / 0xffffffff; - else + if (use_srandom) u = (Awkfloat) (random() % RAND_MAX) / RAND_MAX; + else + u = (Awkfloat)arc4random() / 0xffffffff; break; case FSRAND: if (isrec(x)) /* no argument provided, want arc4random() */ - use_arc4 = 1; + use_srandom = 0; else { - use_arc4 = 0; + use_srandom = 1; u = getfval(x); tmp = u; srandom((unsigned int) u);