Eradicate rand (#6553)

Random seed: always generate 10 digits

Reduce max seed size, this is getting hashed so it's not valuable to have so many characters
This commit is contained in:
Philip Dubé
2026-05-29 21:50:19 +00:00
committed by GitHub
parent 30dcd7946f
commit a3ab0e2bdf
10 changed files with 46 additions and 50 deletions
@@ -8,7 +8,7 @@
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include <stdlib.h>
#include "soh/ShipUtils.h"
#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED)
@@ -104,14 +104,13 @@ void EnBom_Init(Actor* thisx, PlayState* play) {
} else {
// Set random fuse timer with a minimum of 10. Do the sound and scale immediately,
// otherwise the bomb is invisible until the timer hits the "normal" amount.
uint32_t randomTimer = (rand() % 150) + 10;
this->timer = randomTimer;
this->timer = 10 + (s16)(Rand_ZeroOne() * 150.0f);
Audio_PlayActorSound2(thisx, NA_SE_PL_TAKE_OUT_SHIELD);
Actor_SetScale(thisx, 0.01f);
}
if (CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f) != 1.0f) {
this->timer = (s32)(70 * CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f));
this->timer *= CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f);
// Do the sound and scale immediately if GameInteractor hasn't already.
if (!GameInteractor_GetRandomBombFuseTimerActive()) {
Audio_PlayActorSound2(thisx, NA_SE_PL_TAKE_OUT_SHIELD);