I want to place some points in a rectangle randomly. Generating random x,y coordinates it's not a good idea, because many times happens that the points are mainly distributed on the same area instead cover the whole rectangle. I don't need an algorithm incredibly fast or the best cover position, just something that could run in a simple game that generate random (x,y) that cover almost the whole rectangle.
In my particular case I'm trying to generate a simple sky, so the idea is to place almost 40/50 stars in the sky rectangle.
Could someone point me some common algorithm to do that?
Aucun commentaire:
Enregistrer un commentaire