mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
fix Math.natRandom for Windows build
This commit is contained in:
@ -533,7 +533,12 @@ extern "C" JNIEXPORT jdouble JNICALL
|
|||||||
Java_java_lang_Math_natRandom(JNIEnv*, jclass)
|
Java_java_lang_Math_natRandom(JNIEnv*, jclass)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
return rand();
|
int r = rand();
|
||||||
|
if (r == RAND_MAX) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return static_cast<double>(r) / static_cast<double>(RAND_MAX);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
return drand48();
|
return drand48();
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user