Created
December 14, 2015 18:41
-
-
Save Lauler/abb7d9275c3eab43456d to your computer and use it in GitHub Desktop.
Generate csv file with CS 1.6's and CS: GO's different methods for calculating spread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import math | |
def cs16(): | |
with open('CS16spread.csv', 'w') as file: | |
i = 0 | |
file.write("x" + "," + "y" + "\n") | |
while i < 100000: | |
x = random.uniform(-0.5, 0.5) + random.uniform(-0.5, 0.5) | |
y = random.uniform(-0.5, 0.5) + random.uniform(-0.5, 0.5) | |
file.write(str(x) + "," + str(y) + "\n") | |
i += 1 | |
def csgo(): | |
with open('CSgopolar.csv', 'w') as file: | |
i = 0 | |
file.write("x" + "," + "y" + "\n") | |
while i < 100000: | |
theta = 2 * math.pi * random.uniform(0,1) | |
r = random.uniform(-1, 1) | |
x = r * math.cos(theta) | |
y = r * math.sin(theta) | |
file.write(str(x) + "," + str(y) + "\n") | |
i += 1 | |
cs16() | |
csgo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment