Basic Python programming, calculating probabilities of random locations falling within regions using arrays of random locations
Question: Consider a 100X100 array.

  * Generate an array of several thousand random locations within such an array, e.g. (3,75) and (56, 34).
  * Calculate how often one of your random locations falls within 15 pixels of any of the (straight) edges

(I have done these two parts above) But I need help doing:

  1. Calculate how often one of your random locations falls within (either side) 15 pixels of a circle with a radius of 50 pixels, and write the result to the screen e.g. On average N% of the locations in the array fall in this region [N being a number between 0 and 100] Note that coordinates in the corners are within 15 pixels of the circle, then they should be included in this (if they are are more than 15 pixels away, then they shouldn’t be).

  2. Add code that requests a location within your array from the user and then alerts them if that location falls that region, e.g. Warning: your chosen location falls near the edge of the circle.

How do I go about doing this? I already have my array of random locations from
using this code:

    
    
    from pylab import *
    import math as m
    from numpy import *
    from random import randrange
    N = 3000
    coords_array = array([randrange(100) for _ in range(2 * N)]).reshape(N, 2)
    

So how do I go about doing parts (1) and (2)? I was thinking of using a
boolean expression (if, or) to do it, but i am not sure at all if it would
even work, and if it would how to do it.


Answer: This isn't a homework question, is it?

To deal with the circle business, I would begin with a check to see that the
point does not fall within the off-limits area. If your circle is centered at
(0,0), then the off-limits area is `35 <= x**2 + y**2 <= 65`

