diff --git a/applications/external b/applications/external index e06c164aab..29da430571 160000 --- a/applications/external +++ b/applications/external @@ -1 +1 @@ -Subproject commit e06c164aab830c8f4248011e8cc72f1665381678 +Subproject commit 29da430571f744a263a9d1704653dfdc0bf46c51 diff --git a/applications/system/js_app/modules/js_math.c b/applications/system/js_app/modules/js_math.c index 80d97fb9cf..e7daae41b8 100644 --- a/applications/system/js_app/modules/js_math.c +++ b/applications/system/js_app/modules/js_math.c @@ -211,7 +211,7 @@ void js_math_random(struct mjs* mjs) { mjs_return(mjs, MJS_UNDEFINED); } const uint32_t random_val = furi_hal_random_get(); - double rnd = (double)random_val / RAND_MAX; + double rnd = (double)random_val / FURI_HAL_RANDOM_MAX; mjs_return(mjs, mjs_mk_number(mjs, rnd)); } diff --git a/targets/furi_hal_include/furi_hal_random.h b/targets/furi_hal_include/furi_hal_random.h index 051b6f928d..20c6c3357d 100644 --- a/targets/furi_hal_include/furi_hal_random.h +++ b/targets/furi_hal_include/furi_hal_random.h @@ -6,12 +6,16 @@ extern "C" { #endif +#define FURI_HAL_RANDOM_MAX 0xFFFFFFFF + /** Initialize random subsystem */ void furi_hal_random_init(void); /** Get random value + * furi_hal_random_get() gives up to FURI_HAL_RANDOM_MAX + * rand() and random() give up to RAND_MAX * - * @return random value + * @return 32 bit random value (up to FURI_HAL_RANDOM_MAX) */ uint32_t furi_hal_random_get(void);