mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:47:35 +00:00
LibJS: Always use AK::get_random() in Math.random()
Let AK deal with the underlying platform instead of having __serenity__ specific code in LibJS.
This commit is contained in:
parent
47420e72b8
commit
eaf904000f
1 changed files with 0 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue