commit
a2a4dfc673
@ -13,6 +13,16 @@ static settings::Int namesteal{ "name.namesteal", "0" };
|
|||||||
|
|
||||||
static std::string stolen_name;
|
static std::string stolen_name;
|
||||||
|
|
||||||
|
int getRng(int min, int max)
|
||||||
|
{
|
||||||
|
static std::random_device rd;
|
||||||
|
std::uniform_int_distribution<int> unif(min, max);
|
||||||
|
static std::mt19937 rand_engine(rd());
|
||||||
|
|
||||||
|
int x = unif(rand_engine);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
// Func to get a new entity to steal name from and returns true if a target has
|
// Func to get a new entity to steal name from and returns true if a target has
|
||||||
// been found
|
// been found
|
||||||
bool StolenName()
|
bool StolenName()
|
||||||
@ -72,7 +82,7 @@ bool StolenName()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Get random number that we can use with our array
|
// Get random number that we can use with our array
|
||||||
int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F));
|
int target_random_num = getRng(0, potential_targets_length - 1);
|
||||||
|
|
||||||
// Get a idx from our random array position
|
// Get a idx from our random array position
|
||||||
int new_target = potential_targets[target_random_num];
|
int new_target = potential_targets[target_random_num];
|
||||||
|
Reference in New Issue
Block a user