mardi 15 septembre 2020

How to get 'n' uniform random points between start and end coordinates in python?

I have a starting coordinate (x1,y1) and an ending coordinate (x2, y2). I want to generate 'n' uniform random points between start and end coordinates without any duplicates. How to do this with python?

I know that a simple way would be to generate 'n' x values and 'n' y values. So we get n*n pairs and I choose 'n' among them with no duplicates. This way I mayn't get a uniform distribution of random points. Any other way to do this?

Edit: I require floating point coordinates in the rectangle formed by the start and end coordinates as opposite corners.




Aucun commentaire:

Enregistrer un commentaire