wasm: fix duplicate random function

This commit is contained in:
Alexey Andreev 2023-09-25 21:23:46 +02:00
parent 46790d11db
commit 5a0c418389

View File

@ -164,14 +164,19 @@ public final class TMath extends TObject {
@Unmanaged
public static double random() {
return PlatformDetector.isC() ? randomC() : randomImpl();
if (PlatformDetector.isC()) {
return randomC();
} else if (PlatformDetector.isWebAssembly()) {
return WasmSupport.random();
} else {
return randomImpl();
}
}
@Import(name = "teavm_rand")
private static native double randomC();
@GeneratedBy(MathNativeGenerator.class)
@Import(module = "teavmMath", name = "random")
private static native double randomImpl();
public static int min(int a, int b) {