Re: cross-platform thread-safe RNG drand48_r

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My advice would be to get a good wrapper on  SFMT (simd fast mersenne
twister), and create a differently seeded instance per thread.  This
is likely much faster and produces better random numbers than drand48.
 The code will then be portable as well.

  Brian

On Mon, Jun 7, 2010 at 9:30 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
> Qianqian Fang <fangqq@xxxxxxxxx> writes:
>
>> On 06/06/2010 11:37 PM, Ian Lance Taylor wrote:
>>>
>>> As far as I know drand48 is not in POSIX.  It's in the SVID and it's
>>> in X/Open, but I don't think it's in POSIX proper.  And as far as I
>>> know drand48_r is just a GNU extension to drand48.  But it's certainly
>>> possible that POSIX picked this up somewhere.
>>>
>>
>> thanks for the quick response. I have a silly question though:
>> which standard are supposed to be supported by ggc of all
>> platforms? POSIX? SVID? c99?
>
> gcc is only a compiler.  It fully supports the C90 standard with
> respect to compiler behaviour.  It mostly supports the C99 standard;
> exact C99 status can be found at http://gcc.gnu.org/c99status.html .
> However, all these standards also specify library behaviour.  gcc does
> not include a library.  gcc can be used with a POSIX compliant library
> to support a full POSIX compilation environment, but gcc does not
> itself provide a POSIX compliant library.
>
> I believe that Windows has a POSIX mode but it is not the usual
> Windows programming environment and I don't know how well it works.
> As far as I know Mac OS X provides a POSIX library.
>
> Ian
>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux