Comment #0 by bearophile_hugs — 2010-11-24T11:42:07Z
I think the std.c.stdlib.RAND_MAX (core.stdc.stdlib.RAND_MAX) value is hardcoded in Phobos, in a line of the two "stdlib.d" files:
enum RAND_MAX = 32767;
If this is true, then it's an error, because in other systems rand() may return other values. In particular, on an Ubuntu Linux I have seen RAND_MAX needs to be int.max instead of short.max. So this value has to change according to the situation.
Comment #1 by bugzilla — 2010-11-24T12:35:54Z
On ubuntu it is 2147483647.
It still must be hardcoded, as it is a compile time constant, but version'd for the different platforms.
Comment #2 by ibuclaw — 2010-11-24T13:04:50Z
Having a quick look round, it is 0x7FFFFFFF on FreeBSD and OSX too. (Hexadecimal value for 2147483647).
Regards
Comment #3 by bugzilla — 2011-02-03T01:25:21Z
std.c.stdlib now just contains a public import of core.stdc.stdlib, so I'm reassigning this report to druntime. I've also fixed it in my druntime fork and sent a pull request:
https://github.com/D-Programming-Language/druntime/pull/2