Re: The POSIX random-number generator

Keith Marshall <[email protected]> Fri, 2 Apr 2021 22:36:29 +0100
Newsgroups gmane.comp.gnu.mingw.user
Organization MinGW.org Project
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============7169998132254968754==
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="RiA5YYhCbGsGchGsAziFOS69xvUSgEY1N"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--RiA5YYhCbGsGchGsAziFOS69xvUSgEY1N
Content-Type: multipart/mixed; boundary="eeubAGkPuj0v32kkJsvLZxUIZPqxPHFUG";
 protected-headers="v1"
From: Keith Marshall <[email protected]>
Reply-To: keith.d.marshall-XZoyATsUNX5Wk0Htik3J/[email protected]
To: [email protected]
Message-ID: <81d8a1a7-3c1d-f4ae-5eff-342f1c5cae5f-JlWs9+JhQMeJPt80KsDg5Q@public.gmane.org>
Subject: Re: [MinGW-Users] The POSIX random-number generator
References: <20210328174329.a820f267d66c641f83a6df60-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
In-Reply-To: <20210328174329.a820f267d66c641f83a6df60-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

--eeubAGkPuj0v32kkJsvLZxUIZPqxPHFUG
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 28/03/2021 15:43, Anton Shepelev wrote:
> I cannot build the last version of the Netpbm package because it now
> depends on the random() and srandom() functions from POSIX:>
>              https://manned.org/random.3
>=20
> Will the maintainers consider providing them in MinGW to simplify the
> building of code that depends on basic POSIX facilities?

Sorry, but my initial inclination is to say no; my rationale is:

- https://pubs.opengroup.org/onlinepubs/9699919799/functions/random.html
  indicates that this PRNG API is guaranteed to be available, only when
  the system declares support for the extended X/Open Systems Interfaces
  option; thus, it isn't a basic POSIX facility ... it is optional.

- MinGW offers only a subset of basic POSIX facilities; there is little
  incentive to support non-trivial XSI options.

- POSIX.1 itself, advises against use of the random()/srandom() API, in
  any non-trivial context.

- Gratuitous use of such APIs is, IMO, a bug in the upstream package; it
  should be reported as such, and the onus should lie with the offending
  package, to provide a suitable fall-back implementation for any system
  which does not support the API ... if reproducible PRNG sequences are
  a requirement, perhaps consider GNULIB?  Otherwise, MS-Windows' own
  CryptGenRandom() API may be an appropriate choice?

- Development of a PRNG, of satisfactory quality, is a non-trivial task,
  which I do not wish to undertake; even if I did, I would be unwilling
  to offer any guarantee of statistically acceptable quality.

--=20
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


--eeubAGkPuj0v32kkJsvLZxUIZPqxPHFUG--

--RiA5YYhCbGsGchGsAziFOS69xvUSgEY1N
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAmBnjl0FAwAAAAAACgkQwK02xjR+Wj+R
yA/+PgUm6hXcMtSsffvVdD84Qz6/IRwN61FD3U7y/ZacCD8jImm3LFofFFcvWz8Iny0rQXQQIFtl
MRg1jwCjxydB7LEYtQQxS1sSxB7+IgbX3zYw/Vbryfsu1NV21rRlqP9efbrNQjK6yAjqWQEmoC8H
fmmciJfSXtREe0Xyc4P4FXBxsjY68vM5euY5nK7QHjXzixAOZb+XbpsXL0x923+GrG9KCk/aTPPY
khUcqdcC5nkXG6QnIFBV9U+YTnLp12VMWBfvA8M/zO0Mt7dndmqLzcJ6VxXVgEybF8bsQNAcvLHL
kTJTk9y8AUktVGGsYAsudXDq9FgEjp2dAQ9YwNcsjSyYoCtTrjXRlIh0c+jWRrIMeHFnwWDGUWrv
80JbtPAf4GeG6xW3hEgDYeP+tq5It+DCuLWUe+9Z0Y4gthMEhkMDsTUj0ebdqWYuXCgz7pZ9X+4f
Qkh49zn3SICF+HZwUo0TJ1JVSURiVPhIdOKEBp/cPW331LozJ85pCfSRoRyJ9sw39soqGdYhe1KK
0wU6xOPHMS5sJ1SNj9hMWVU0YDfPA8LWEsTjb0vkF1lapL2QTKtL0qRtBK+GTAZ1MgTDqYRPzDTg
176bpDE539vf+VLDdrrBp8Lf1oUG+wb9FziAY7UZedA2EHf08AJyG2TFtXwYoUwnAf7XiVUA3MLi
ciM=
=JJob
-----END PGP SIGNATURE-----

--RiA5YYhCbGsGchGsAziFOS69xvUSgEY1N--


--===============7169998132254968754==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTWluR1ctVXNl
cnMgbWFpbGluZyBsaXN0Ck1pbkdXLVVzZXJzQGxpc3RzLm9zZG4ubWUKClRoaXMgbGlzdCBvYnNl
cnZlcyB0aGUgUG9zdGluZyBFdGlxdWV0dGUsIGFzIGRlc2NyaWJlZCBhdCBodHRwczovL21pbmd3
Lm9zZG4uaW8vaW5kZXguaHRtbD9wYWdlPW1haWxpbmcuaHRtbCNsaXN0LWV0aXF1ZXR0ZS4KV2Ug
YXNrIHRoYXQgeW91IGJlIHBvbGl0ZSBhbmQgZG8gdGhlIHNhbWUuICBEaXNyZWdhcmQgZm9yIHRo
ZSBsaXN0IGV0aXF1ZXR0ZSBtYXkgY2F1c2UgeW91ciBhY2NvdW50IHRvIGJlIG1vZGVyYXRlZC4K
Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCllvdSBtYXkg
Y2hhbmdlIHlvdXIgTWluR1cgQWNjb3VudCBPcHRpb25zIG9yIHVuc3Vic2NyaWJlIGF0OgpodHRw
czovL2xpc3RzLm9zZG4ubWUvbWFpbG1hbi9saXN0aW5mby9taW5ndy11c2VycwpBbHNvOiBtYWls
dG86bWluZ3ctdXNlcnMtcmVxdWVzdEBsaXN0cy5vc2RuLm1lP3N1YmplY3Q9dW5zdWJzY3JpYmU=

--===============7169998132254968754==--