HomeFreeBSD

qmath(3) test: Replace overcomplicated abomination with arc4random(3)

Description

qmath(3) test: Replace overcomplicated abomination with arc4random(3)

The horrific GENRAND construction bent over backwards to construct 64-bit
signed integers from the 31-bit output of random(3) for about 20 numbers per
test. Reproducibility wasn't a goal: random(3) was seeded with
srandomdev(3). Speed is not a factor for generating 20 integers with
arc4random(3). Range is not a factor: all uses did not bound the range
beyond that of the full [INT64_MIN, INT64_MAX]. Just use arc4random(3).

Reported by: Coverity
CIDs: 1404809, 1404817, 1404838, 1404840 and about 6x other

		identical reports of dubious code relating to the
		construction

Details

Provenance
cemAuthored on Jan 29 2020, 5:25 AM
Parents
rG82b5e6440d0a: qlxge(4): Ditto r357244
Branches
Unknown
Tags
Unknown

Event Timeline