<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib/rand.c, branch releng/12.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2017-11-20T19:49:47Z</updated>
<entry>
<title>General further adoption of SPDX licensing ID tags.</title>
<updated>2017-11-20T19:49:47Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-11-20T19:49:47Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8a16b7a18f5d0b031f09832fd7752fba717e2a97'/>
<id>urn:sha1:8a16b7a18f5d0b031f09832fd7752fba717e2a97</id>
<content type='text'>
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
</content>
</entry>
<entry>
<title>1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes</title>
<updated>2016-05-29T13:57:06Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2016-05-29T13:57:06Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=44f87738345ccf7da818c80cefac28916928bebb'/>
<id>urn:sha1:44f87738345ccf7da818c80cefac28916928bebb</id>
<content type='text'>
reading hard.

2) Instead of doing range transformation in each and every function here,
do it single time directly in do_rand(). One "mod" operation overhead is not
a big deal, but the code looks nicer and possible future functions additions
or PRNG change do not miss range transformations neither have unneeded ones.

3) Use POSIX argument types for visible functions (cosmetic).

MFC after:      1 week
</content>
</entry>
<entry>
<title>libc: do not include &lt;sys/types.h&gt; where &lt;sys/param.h&gt; was already included</title>
<updated>2016-04-18T21:05:15Z</updated>
<author>
<name>Andriy Voskoboinyk</name>
<email>avos@FreeBSD.org</email>
</author>
<published>2016-04-18T21:05:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=2cf5e9365d299ad70ec7fe8a7e7202fbb925e70c'/>
<id>urn:sha1:2cf5e9365d299ad70ec7fe8a7e7202fbb925e70c</id>
<content type='text'>
According to style(9):
&gt; normally, include &lt;sys/types.h&gt; OR &lt;sys/param.h&gt;, but not both.
(&lt;sys/param.h&gt; already includes &lt;sys/types.h&gt; when LOCORE is not defined).
</content>
</entry>
<entry>
<title>Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.</title>
<updated>2015-09-20T20:24:28Z</updated>
<author>
<name>Craig Rodrigues</name>
<email>rodrigc@FreeBSD.org</email>
</author>
<published>2015-09-20T20:24:28Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f98e0c9dd831748338a7856c0e98678ea8181d19'/>
<id>urn:sha1:f98e0c9dd831748338a7856c0e98678ea8181d19</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Style fix noted by bde@</title>
<updated>2013-07-04T12:35:39Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2013-07-04T12:35:39Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=61762e7dbc49a0c8f369931ee12a2bbda888e203'/>
<id>urn:sha1:61762e7dbc49a0c8f369931ee12a2bbda888e203</id>
<content type='text'>
</content>
</entry>
<entry>
<title>After fixing ranges restore POSIX requirement: rand() call without</title>
<updated>2013-07-04T00:02:10Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2013-07-04T00:02:10Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=7d815fd551b61fca7e4e0308ed1449e6bfa02e58'/>
<id>urn:sha1:7d815fd551b61fca7e4e0308ed1449e6bfa02e58</id>
<content type='text'>
srand() must be the same as srand(1); rand();
(yet one increment)
</content>
</entry>
<entry>
<title>In addition to prev. commit, for repeated rand_r(3) calls don't forget</title>
<updated>2013-07-03T23:27:04Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2013-07-03T23:27:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=df5c65e22a92650e4cb34f8c9ea8d0c89a80c861'/>
<id>urn:sha1:df5c65e22a92650e4cb34f8c9ea8d0c89a80c861</id>
<content type='text'>
to compensate back at the end incremented at the start internal
state.

MFC after:      2 weeks
</content>
</entry>
<entry>
<title>1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range,</title>
<updated>2013-07-03T21:21:54Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2013-07-03T21:21:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=476d9314d6247b8386926960081689e8f395594c'/>
<id>urn:sha1:476d9314d6247b8386926960081689e8f395594c</id>
<content type='text'>
but ACM formula we use have internal state (and return value) in the
[1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached
because it is off by one, zero is not reached too.

Correct both RAND_MAX and rand(3) return value, shifting last one
to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new RAND_MAX)]
range.

2) Add a checks for not overflowing on too big seeds. It may happens on
the machines, where sizeof(unsigned int) &gt; 32 bits.

Reviewed by:    bde [1]
MFC after:      2 weeks
</content>
</entry>
<entry>
<title>Renumber clauses to reduce diffs to other versions</title>
<updated>2013-06-13T00:19:30Z</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2013-06-13T00:19:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=580b4d185bc1d20da91429229920ce590309cbf6'/>
<id>urn:sha1:580b4d185bc1d20da91429229920ce590309cbf6</id>
<content type='text'>
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
</content>
</entry>
<entry>
<title>Replace access to /dev/random with the kernel pseudo-random number</title>
<updated>2013-04-02T23:41:20Z</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2013-04-02T23:41:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=12a6865090ad2f88c671256c53a8fed4d5424424'/>
<id>urn:sha1:12a6865090ad2f88c671256c53a8fed4d5424424</id>
<content type='text'>
source sysctl(KERN_ARND) and remove the fallback code.

Obtained from:	OpenBSD
Reviewed by:	secteam
MFC after:	1 month
</content>
</entry>
</feed>
