> Hi, man ksh says: > > RANDOM A random number generator. Every time RANDOM is referenced, > it is assigned the next random number in the range 0-32767. > By default, arc4random(3) is used to produce values. If the > variable RANDOM is assigned a value, the value is used as the > seed to srand(3) and subsequent references of RANDOM will use > rand(3) to produce values, resulting in a predictable > sequence. > > however, man srand says: > > To satisfy portable code, srand() may be called to initialize the > subsystem. In OpenBSD the seed variable is ignored, and strong random > number results will be provided from arc4random(3). In other systems, > the seed variable primes a simplistic deterministic algorithm. > > If the standardized behavior is required srand_deterministic() can be > substituted for srand(), then subsequent rand() calls will return results > using the deterministic algorithm. >
And the part you missed from the ksh source code: static void setspec(struct tbl *vp) { ... case V_RANDOM: vp->flag &= ~SPECIAL; srand_deterministic((unsigned int)intval(vp)); vp->flag |= SPECIAL; break; setspec is called when a "special" variable is assigned to. If RANDOM is assigned to, it does what the manual page says. Careful with your allegations, ok?