<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib/random.3, branch releng/14.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F14.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F14.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2023-08-16T17:55:15Z</updated>
<entry>
<title>Remove $FreeBSD$: one-line nroff pattern</title>
<updated>2023-08-16T17:55:15Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b2c76c41be32f904179efed29c0ca04d53f3996c'/>
<id>urn:sha1:b2c76c41be32f904179efed29c0ca04d53f3996c</id>
<content type='text'>
Remove /^\.\\"\s*\$FreeBSD\$$\n/
</content>
</entry>
<entry>
<title>rand(3): Replace implementation with one backed by random(3) algorithm</title>
<updated>2020-02-01T20:33:23Z</updated>
<author>
<name>Conrad Meyer</name>
<email>cem@FreeBSD.org</email>
</author>
<published>2020-02-01T20:33:23Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=672e12255da9b211d5318889ed9441ffc63c9f30'/>
<id>urn:sha1:672e12255da9b211d5318889ed9441ffc63c9f30</id>
<content type='text'>
rand(3)'s standard C API is extremely limiting, but we can do better
than the historical 32-bit state Park-Miller LCG we've shipped since
2001: r73156.

The justification provided at the time for not using random(3) was that
rand_r(3) could not be made to use the same algorithm.  That is still
true.  However, the irrelevance of rand_r(3) is increasingly obvious.
Since that time, POSIX has marked the interface obsolescent.  rand_r(3)
never became part of the standard C library.  If not for API
compatibility reasons, I would just remove rand_r(3) entirely.

So, I do not believe it is a problem for rand_r(3) and rand(3) to
diverge.

The 12 ABI is maintained with compatibility definitions, but this
revision does subtly change the API of rand(3).  The sequences of
pseudorandom numbers produced in programs built against new versions of
libc will differ from programs built against prior versions of libc.

Reviewed by:	kevans, markm
MFC after:	no
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D23290
</content>
</entry>
<entry>
<title>random.3: Some minor improvements to wording/clarity</title>
<updated>2020-01-20T23:44:10Z</updated>
<author>
<name>Conrad Meyer</name>
<email>cem@FreeBSD.org</email>
</author>
<published>2020-01-20T23:44:10Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=825a73c36fad8c124870619e4d798c6867424ead'/>
<id>urn:sha1:825a73c36fad8c124870619e4d798c6867424ead</id>
<content type='text'>
</content>
</entry>
<entry>
<title>random.3: Remove obsolete BUGS section</title>
<updated>2019-04-22T16:29:34Z</updated>
<author>
<name>Conrad Meyer</name>
<email>cem@FreeBSD.org</email>
</author>
<published>2019-04-22T16:29:34Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=680defa7cefe932be1a4d3f3bf97c6e5d2eb63e3'/>
<id>urn:sha1:680defa7cefe932be1a4d3f3bf97c6e5d2eb63e3</id>
<content type='text'>
Relative performance to rand(3) is sort of irrelevant; they do different things
and a user with sensitivity to RNG performance won't use libc random(3) anyway.

The historical note about bad seeding is long obsolete, referring to a 1996 or
earlier version of FreeBSD.

Sponsored by:	Dell EMC Isilon
</content>
</entry>
<entry>
<title>random.3: Clarify confusing summary</title>
<updated>2019-04-15T18:49:04Z</updated>
<author>
<name>Conrad Meyer</name>
<email>cem@FreeBSD.org</email>
</author>
<published>2019-04-15T18:49:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1631235aa6084c51978c52785c6c0e9837c0a5ba'/>
<id>urn:sha1:1631235aa6084c51978c52785c6c0e9837c0a5ba</id>
<content type='text'>
random.3 is only "better" in contrast to rand.3.  Both are non-cryptographic
pseudo-random number generators.  The opening blurbs of each's DESCRIPTION
section does emphasize this, and correctly directs unfamiliar developers to
arc4random(3).  However, the summary (".Nd" or Name description) of random.3
conflicted in tone and message with that warning.

Resolve the conflict by clarifying in the Nd section that random(3) is
non-cryptographic and pseudo-random.  Elide the "better" qualifier which
implied a comparison but did not provide a specific object to contrast.

Sponsored by:	Dell EMC Isilon
</content>
</entry>
<entry>
<title>Fix typing of srandom() and initstate().</title>
<updated>2016-07-26T20:11:29Z</updated>
<author>
<name>Ed Schouten</name>
<email>ed@FreeBSD.org</email>
</author>
<published>2016-07-26T20:11:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8de6c267117c2eb423b1a940601d8e4d525c5f4d'/>
<id>urn:sha1:8de6c267117c2eb423b1a940601d8e4d525c5f4d</id>
<content type='text'>
POSIX requires that these functions have an unsigned int for their first
argument; not an unsigned long.

My reasoning is that we can safely change these functions without
breaking the ABI. As far as I know, our supported architectures either
use registers for passing function arguments that are at least as big as
long (e.g., amd64), or int and long are of the same size (e.g., i386).

Reviewed by:	ache
Differential Revision:	https://reviews.freebsd.org/D6644
</content>
</entry>
<entry>
<title>Reflect error indication according to POSIX and what those functions</title>
<updated>2016-06-05T15:46:14Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2016-06-05T15:46:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=16bf528dc243f86776a443cba84866cfd7d2027e'/>
<id>urn:sha1:16bf528dc243f86776a443cba84866cfd7d2027e</id>
<content type='text'>
currently do.
</content>
</entry>
<entry>
<title>Adjust wording slightly to emphasize that random(3) should not be used for</title>
<updated>2015-02-25T07:49:15Z</updated>
<author>
<name>Colin Percival</name>
<email>cperciva@FreeBSD.org</email>
</author>
<published>2015-02-25T07:49:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=eb51316b50c8cdc4b0397a569e18619778bea5c5'/>
<id>urn:sha1:eb51316b50c8cdc4b0397a569e18619778bea5c5</id>
<content type='text'>
any applications which need unpredictable random numbers, not merely those
which are cryptographic in nature.

If you work for a lottery and you're using random(3) to select the winning
numbers, please let me know.
</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>
