Like in this image,player is the red point,and I want to get random point in black area.
Idk about c++, but with blueprints you would take the random unit vector node and multiply the by the radius of your circle. Could use the random float in range node for the radius to control the width of the circle.
Can you post a picture about the blueprint you talk?I’m not familiar with blueprint
Here the c++ version:
3D :
auto result = FMath::VRand();
result *= FMath::RandRange(BlackAreaInnerRadius,BlackAreaOuterRaduis);
2D :
auto result = FVector2D(FMath::VRand());
result.Normalize();
result *= FMath::RandRange(BlackAreaInnerRadius,BlackAreaOuterRaduis);
you would need to add the player location to the result obviously