#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 15:45:39 2024

@author: sam
"""

import numpy as np
import matplotlib.pyplot as plt

U = np.random.uniform(-1,1,[1000,2]) # generates 1000 uniform random numbers with 2 dimensions between -1 and 1

'''a)'''

for i in range(1000): # iterates over random numbers
    plt.plot(U[i][0],U[i][1],'.') # plots each number (as a dot) with index i's x component (U[i][0]) on the x axis and y component (U[i][1]) on the y axis
plt.show() # plots seperately to the next one

'''b)'''

def region(x,y):
    if (x**2 + y**2) <= 1: # checks if within the unit circle
        return True # returns True
    else:
        return False

'''c)'''

for i in range(1000):
    if region(U[i][0],U[i][1]) == True: # if each uniform random number is within the unit circle
        plt.plot(U[i][0],U[i][1],'.') # plot that random number as a dot