Hi,

I tried to solve the coderexercise I.1.1, but I could not.

I looked at similar topics but still I do not manage to solve it.

My code is below, my function randomly generates real and imaginary parts of alpha and betha until getting numbers that satisfy the equation a’**2+b’**2 = 1

Do you have any clues for me to continue the learning path?

Thanks in advance

def my_normalize_state(alpha, beta):

tiene_longitud1 = False

alpha_real = alpha.real

alpha_imag = alpha.imag

```
beta_real = beta.real
beta_imag = beta.imag
result = []
while (not tiene_longitud1):
r_alpha_real = random.uniform (0, alpha_real)
r_alpha_imag = random.uniform (0, alpha_imag)
r_beta_real = random.uniform (-1, beta_real)
r_beta_imag = random.uniform (0, beta_imag)
new_complex_alpha = complex(r_alpha_real, r_alpha_imag)
new_complex_beta = complex(r_beta_real, r_beta_imag)
mod_square_alpha = new_complex_alpha * new_complex_alpha.conjugate()
mod_square_beta = new_complex_beta * new_complex_beta.conjugate()
longitud = mod_square_alpha + mod_square_beta
if (longitud == 1):
tiene_longitud1 = True
result = np.array([new_complex_alpha, new_complex_beta])
return result
```