Replace GetRandomInt()

RageUtil already had a RandomInt function, this wasn't needed after all.
This commit is contained in:
sukibaby
2025-05-03 06:44:34 -07:00
committed by teejusb
parent b7bafbef93
commit d3ff9a0683
4 changed files with 4 additions and 42 deletions
-1
View File
@@ -45,7 +45,6 @@ list(APPEND SMDATA_GLOBAL_SINGLETON_HPP
"NoteSkinManager.h"
"PrefsManager.h"
"ProfileManager.h"
"RandomSeed.h"
"ScreenManager.h"
"SongManager.h"
"StatsManager.h"
+2 -2
View File
@@ -39,7 +39,6 @@
#include "GameCommand.h"
#include "LocalizedString.h"
#include "AdjustSync.h"
#include "RandomSeed.h"
#include <cmath>
#include <cstddef>
@@ -3475,7 +3474,8 @@ RString Player::ApplyRandomAttack()
if( GAMESTATE->m_RandomAttacks.size() < 1 )
return "";
int iAttackToUse = GetRandomInt() % GAMESTATE->m_RandomAttacks.size();
int iAttackToUse = RandomInt(GAMESTATE->m_RandomAttacks.size());
return GAMESTATE->m_RandomAttacks[iAttackToUse];
}
+2
View File
@@ -26,6 +26,8 @@
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <random>
#include <climits>
const RString CUSTOM_SONG_PATH= "/@mem/";
-39
View File
@@ -1,39 +0,0 @@
#ifndef RANDOMSEED_H
#define RANDOMSEED_H
#include <random>
#include <climits>
inline int GetRandomInt()
{
static std::random_device rd;
static std::mt19937 gen(rd());
return std::uniform_int_distribution<int>(0, INT_MAX)(gen);
}
#endif // RANDOMSEED_H
/*
* (c) 2024 sukibaby
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/