bool ShouldHappen(int Percentage )
{
return (FMath::RandRange(1, 100) <= Percentage ? true : false);
}
Here the ternaire is useless
bool ShouldHappen(int Percentage )
{
return FMath::RandRange(1, 100) <= Percentage ;
}
bool UVitalityComponent::ShouldSpawn(float Chance)
{
return (UKismetMathLibrary::RandomBoolWithWeight(Chance) == 1 ? true : false);
}
Same here
bool UVitalityComponent::ShouldSpawn(float Chance)
{
return UKismetMathLibrary::RandomBoolWithWeight(Chance);
}
already return a bool so just use UKismetMathLibrary::RandomBoolWithWeight(Chance)