generated from mwc/lab_scatter
	Initial commit
This commit is contained in:
		
							
								
								
									
										9
									
								
								generate_data.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								generate_data.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
from random import randint, gauss
 | 
			
		||||
 | 
			
		||||
def generate_data(n, xmin, xmax, slope, intercept, error):
 | 
			
		||||
    sample = []
 | 
			
		||||
    for i in range(n):
 | 
			
		||||
        x = randint(xmin, xmax)
 | 
			
		||||
        y = round(gauss(intercept + x * slope, error))
 | 
			
		||||
        sample.append([x, y])
 | 
			
		||||
    return sample
 | 
			
		||||
		Reference in New Issue
	
	Block a user