]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC: r300953
authorache <ache@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 5 Jun 2016 13:39:31 +0000 (13:39 +0000)
committerache <ache@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 5 Jun 2016 13:39:31 +0000 (13:39 +0000)
commitf1ad56d91efb1253e2be8efced6913b3cdc1bfbe
tree1c086a2d853fa0b3b32baf88a346b4bfb2753c32
parent691d48c308e34224a92eb1fa2ca884acaf325267
MFC: r300953

1) Unifdef USE_WEAK_SEEDING it is too obsolete to support and makes reading
harder.

2) ACM paper require seed to be in [1, 2^31-2] range, so use the same range
shifting as already done for rand(3). Also protect srandomdev() + TYPE_0 case
(non default) from negative seeds.

3) Don't check for valid "type" range in setstate(), it is always valid as
calculated. Instead add a check that rear pointer not exceeed end pointer.

MFC: r300965

Micro optimize: C standard guarantees that right shift for unsigned value
fills left bits with zero, and we have exact 32bit unsigned value
(uint32_t), so there is no reason to add "& 0x7fffffff" here.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301443 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/stdlib/random.c