Replace GetRandomInt()
RageUtil already had a RandomInt function, this wasn't needed after all.
This commit is contained in:
@@ -45,7 +45,6 @@ list(APPEND SMDATA_GLOBAL_SINGLETON_HPP
|
|||||||
"NoteSkinManager.h"
|
"NoteSkinManager.h"
|
||||||
"PrefsManager.h"
|
"PrefsManager.h"
|
||||||
"ProfileManager.h"
|
"ProfileManager.h"
|
||||||
"RandomSeed.h"
|
|
||||||
"ScreenManager.h"
|
"ScreenManager.h"
|
||||||
"SongManager.h"
|
"SongManager.h"
|
||||||
"StatsManager.h"
|
"StatsManager.h"
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,6 @@
|
|||||||
#include "GameCommand.h"
|
#include "GameCommand.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "AdjustSync.h"
|
#include "AdjustSync.h"
|
||||||
#include "RandomSeed.h"
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@@ -3475,7 +3474,8 @@ RString Player::ApplyRandomAttack()
|
|||||||
if( GAMESTATE->m_RandomAttacks.size() < 1 )
|
if( GAMESTATE->m_RandomAttacks.size() < 1 )
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
int iAttackToUse = GetRandomInt() % GAMESTATE->m_RandomAttacks.size();
|
int iAttackToUse = RandomInt(GAMESTATE->m_RandomAttacks.size());
|
||||||
|
|
||||||
return GAMESTATE->m_RandomAttacks[iAttackToUse];
|
return GAMESTATE->m_RandomAttacks[iAttackToUse];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <random>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
const RString CUSTOM_SONG_PATH= "/@mem/";
|
const RString CUSTOM_SONG_PATH= "/@mem/";
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
|
||||||
*/
|
|
||||||
Reference in New Issue
Block a user