lundi 2 août 2021

create a random rectangle with limited a limited area [closed]

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#)




Aucun commentaire:

Enregistrer un commentaire