Q:

Using 'If' to run the loop again?

I am producing 2 arrays of random numbers that range from -3 to 3 (this would provide to be my x and y coordinates per say). However I want to produce a new set of numbers if the respective x and y is greater than my radius (which is 3) by using an if loop? What do I put in after my if loop to achieve this?
from physics import *
import random
N=3

x= zeros(N,float)
y= zeros(N,float)

for i in range (0, N):
    x[i] = uniform(6)-3
    y[i] = uniform(6)-3
    if (x[n]*2+y[n]**2)**0.5 > 3:

Thanks

A:

Most random library modules provide a routine to return a floating point number from a uniform distribution over the interval [0,1). To choose randomly from a uniform distribution over the interval [a,b), where b > a, you can just multiply by b-a, and then add a.
I'm not certain which modules you're importing in your example, so I'll give examples using the standard random module, as well as the numpy.random
random 
import random
def rand_range(a, b):
   return a + random.uniform() * (b - a)

x = [rand_range(-3, 3) for i in range(3)]
y = [rand_range(-3, 3) for i in range(3)]

numpy.random
Numpy allows one to vectorize operations for speed and clarity.
import numpy as np
def rand_range(a, b, size):
    return a + np.random.random(size) * (b - a)

x = rand_range(-3, 3, (3))
y = rand_range(-3, 3, (3))

or, create an 2D array of 2 rows of 3 elements, and use unpacking
x, y = rand_range(-3, 3, (2, 3))

bounds checking
In order to ensure the points generated meet the criteria of being with 3 units of x, y = (0, 0), you can do something like the following:
x = []
y = []
for i in range(3):
   xi, yi = 3, 3    #initally set candidates to fail check
   while xi ** 2 + yi ** 2 > 9:
      xi = rand_range(-3, 3)
      yi = rand_range(-3, 3)
   x.append(xi)
   y.append(yi)

Given the underlying random method returns a value on the interval [0,1), these arrays should all pass the following assertion:
for xi, yi in zip(x,y):
   assert xi**2 + yi**2 <= 9

