[MinGW-Users] The POSIX random-number generator

Back to archive index
Keith Marshall keith****@users*****
Thu Apr 8 05:54:28 JST 2021


On 02/04/2021 22:36, Keith Marshall wrote:
> 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 ...

Notwithstanding my reluctance to support this, FWIW I did find

   https://www.mathstat.dal.ca/~selinger/random/

from which, with hints from the GNULIB random_r.c implementation[1],
I've derived the attached patch.

While I still will not attest to the statistical reliability of this, if
you would care to submit a formal feature request[2], and there is
sufficient interest expressed, (by way of up-votes), I may consider
incorporation into libmingwex.a, subject to a requirement for the caller
to define either _XOPEN_SOURCE >= 500, or _BSD_SOURCE, before including
<stdlib.h>, to expose the API declarations.

[1] https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/random_r.c
Although GNULIB modules are normally licensed under LGPL, (which is NOT
compatible with the licence requirements for libmingwrt.a), this file
also exhibits a BSD licence, (which IS compatible).  Thus, I believe
that I am justified in incorporating hints as to suitable constant
definitions, under the terms of the BSD licence.

[2] https://mingw.osdn.io/index.html?page=contact.html#feature-request

-- 
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: posix-prng-implementation.patch
Type: text/x-patch
Size: 14737 bytes
Desc: not available
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20210407/7f2f6f6f/attachment.bin>


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