mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
fix Math.natRandom for Windows build
This commit is contained in:
parent
51a731847a
commit
3c237547ee
@ -533,7 +533,12 @@ extern "C" JNIEXPORT jdouble JNICALL
|
||||
Java_java_lang_Math_natRandom(JNIEnv*, jclass)
|
||||
{
|
||||
#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
|
||||
return drand48();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user