summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-30 13:52:59 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-30 18:35:36 +0200
commiteaf904000fab96bfac5245de27e9577d4cbce004 (patch)
treefc61a3ea73cfee10ad1cd0f496eb48495b8f6fe0 /Userland/Libraries/LibJS
parent47420e72b8c08ed659a0d8ff4f349f50252977bd (diff)
downloadserenity-eaf904000fab96bfac5245de27e9577d4cbce004.zip
LibJS: Always use AK::get_random() in Math.random()
Let AK deal with the underlying platform instead of having __serenity__ specific code in LibJS.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/MathObject.cpp4
1 files changed, 0 insertions, 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<u32>() / (double)UINT32_MAX;
-#else
- double r = (double)rand() / (double)RAND_MAX;
-#endif
return Value(r);
}