Skip to content

Instantly share code, notes, and snippets.

@juanitobanca
Last active October 26, 2019 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanitobanca/3f672d03d75512e584dcad98d65a04aa to your computer and use it in GitHub Desktop.
Save juanitobanca/3f672d03d75512e584dcad98d65a04aa to your computer and use it in GitHub Desktop.
Simulaciones
import random as r
import csv
n = 10000000
min = []
res = []
pts = [ 10, 9, 8, 7, 6, 5.5, 5, 4.5, 4, 3.5 ]
for i in range(0, n ):
r.shuffle(pts)
res = pts.copy()
r.shuffle(pts)
res = [ r1 + r2 for r1, r2 in zip( res, pts ) ]
res.sort()
min.append([res[2]])
with open('LMP_2019.csv', 'w', newline='') as archivo: # Python 3
w = csv.writer(archivo, delimiter='\t') # override for tab delimiter
w.writerows(min)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment