mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
wasm: fix duplicate random function
This commit is contained in:
parent
46790d11db
commit
5a0c418389
|
@ -164,14 +164,19 @@ public final class TMath extends TObject {
|
||||||
|
|
||||||
@Unmanaged
|
@Unmanaged
|
||||||
public static double random() {
|
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")
|
@Import(name = "teavm_rand")
|
||||||
private static native double randomC();
|
private static native double randomC();
|
||||||
|
|
||||||
@GeneratedBy(MathNativeGenerator.class)
|
@GeneratedBy(MathNativeGenerator.class)
|
||||||
@Import(module = "teavmMath", name = "random")
|
|
||||||
private static native double randomImpl();
|
private static native double randomImpl();
|
||||||
|
|
||||||
public static int min(int a, int b) {
|
public static int min(int a, int b) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user