Solution for create a random rectangle with limited a limited area [closed]
is Given Below:
I need to generate a rectangle with random dimentions, but I want to avoid generating any rectangles above a specified area limit. Notice I said area, I can’t simply have a random value within a certain range be generated for each axis independently.
In practice I need to generate a set of two values that have a product within a certain range.
Heres kinda what i’d need:
//generates any 2 numbers that multiply to less then 30 and more then 0 randomArea = Vector2 Random.Area(0, maxArea)
(Answers preferably in C#)
Randomly generate the area.
Randomly generate one axis.
Divide the area by the axis, and you will get the other axis.