From eaf904000fab96bfac5245de27e9577d4cbce004 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 30 Aug 2021 13:52:59 +0200 Subject: [PATCH] LibJS: Always use AK::get_random() in Math.random() Let AK deal with the underlying platform instead of having __serenity__ specific code in LibJS. --- Userland/Libraries/LibJS/Runtime/MathObject.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.cpp b/Userland/Libraries/LibJS/Runtime/MathObject.cpp index 0ee372ea81..5d8279ac5a 100644 --- a/Userland/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/MathObject.cpp @@ -96,11 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::abs) // 21.3.2.27 Math.random ( ), https://tc39.es/ecma262/#sec-math.random JS_DEFINE_NATIVE_FUNCTION(MathObject::random) { -#ifdef __serenity__ double r = (double)get_random() / (double)UINT32_MAX; -#else - double r = (double)rand() / (double)RAND_MAX; -#endif return Value(r); }