We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4445618 commit 4fbbb84Copy full SHA for 4fbbb84
c-dependencies/js-compute-runtime/js-compute-builtins.cpp
@@ -4404,11 +4404,10 @@ bool process_network_io(JSContext *cx) {
4404
}
4405
4406
bool math_random(JSContext *cx, unsigned argc, Value *vp) {
4407
- int32_t storage;
4408
- int32_t *buf = &storage;
4409
- random_get((int32_t)buf, sizeof(storage));
4410
- uint32_t value = storage + std::pow(2, 32);
4411
- double newvalue = static_cast<float>(value) / std::powf(2.0, 32.0);
+ unt32_t storage;
+ unt32_t *buf = &storage;
+ random_get((int32_t)(&buf), sizeof(storage));
+ double newvalue = static_cast<double>(storage) / std::pow(2.0, 32.0);
4412
4413
CallArgs args = CallArgsFromVp(argc, vp);
4414
args.rval().setDouble(newvalue);
0 commit comments