[LLVMdev] Use rand_r() instead of non-reentrant thread-unsafe rand() in GetRandomNumber()

Krzysztof Parzyszek kparzysz at codeaurora.org
Sat Dec 1 16:19:56 PST 2012


On 12/1/2012 6:02 PM, Justin Holewinski wrote:
>
> And if randr_r() is obsolete, I'm not sure we should be using it.  What
> platforms have you tested this on?  Is it available on Windows, Mac,
> BSDs?  If not touching global state is important enough, perhaps we
> should add a (simple) random number generator to the Support library.  I
> don't think LLVM would require anything fancy.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/drand48.html

We could use nrand48 for example, if it's available.

-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list