I'm trying to generate 1000-10000 points with random position inside a circle ( which is drawn inside a square) with radius of 1, and by using the formula x^2 + y^2 = 1 to decide whether which one is inside the circle. I got the idea but I'm pretty new to python so I don't exactly know how to execute them
            Asked
            
        
        
            Active
            
        
            Viewed 252 times
        
    1
            
            
        - 
                    1Welcome to SO. Please take the time to read [ask] and the other links found on that page. Your question is either too broad or off topic: this isn't a tutorial or discussion forum. – wwii Jul 03 '19 at 02:18
- 
                    In addition to the methods described in the question above, you can also just use rejection sampling: generate a point and see if it is in the circle, then generate a new one if needed. Repeat until you get a point in the circle. – iz_ Jul 03 '19 at 02:31
1 Answers
0
            
            
        You can generate a random integer by using this example:
import random
random.randint(0,10) # this returns and integer between 0 and 10
Now that you know how to generate random integers, you can apply to your logic.
For more details, check the randint documentation.
 
    
    
        lgigek
        
- 100
- 1
- 7
 
    