Python: (uniform) sampling from a rectangle
I think modulo operator (%) is your friend to check if x and y are in [a,c] and [b,d]
If you can't use random between 2 numbers (others 0 and 1), you can try to make x = (random() *(c-a)+a)
Same with y :)
EDIT : Oh, i send it just after Merig
Say I have a rectangle [a,b]x[c,d], where a,b,c,d are reals.
I would like to produce k points (x,y) sampled uniformly from this rectangle, i.e. a <= x <= c and b <= y <= d.
Obviously, if sampling from [0,1]x[0,1] is possible, then
the problem is solved. How to achieve any of the two goals, in python?
Or, another tool such as R, for example?