mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:52:07 +00:00
Userland: Replace arc4random() with get_random<u32>()
This commit is contained in:
parent
5a0468c21f
commit
090936e424
8 changed files with 19 additions and 12 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Random.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/MathObject.h>
|
||||
#include <math.h>
|
||||
|
@ -86,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::abs)
|
|||
JS_DEFINE_NATIVE_FUNCTION(MathObject::random)
|
||||
{
|
||||
#ifdef __serenity__
|
||||
double r = (double)arc4random() / (double)UINT32_MAX;
|
||||
double r = (double)get_random<u32>() / (double)UINT32_MAX;
|
||||
#else
|
||||
double r = (double)rand() / (double)RAND_MAX;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue