[MinGW-Users] The POSIX random-number generator

Back to archive index
Keith Marshall keith****@users*****
Sat Apr 3 06:36:29 JST 2021


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
> 
> 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.

-- 
Regards,
Keith.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20210402/1563bb08/attachment.sig>


More information about the MinGW-Users mailing list
Back to archive index