Parcourir la source

LibJS: Always use AK::get_random() in Math.random()

Let AK deal with the underlying platform instead of having __serenity__
specific code in LibJS.
Andreas Kling il y a 3 ans
Parent
commit
eaf904000f
1 fichiers modifiés avec 0 ajouts et 4 suppressions
  1. 0 4
      Userland/Libraries/LibJS/Runtime/MathObject.cpp

+ 0 - 4
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);
 }