Skip to content

Instantly share code, notes, and snippets.

@Lauler
Created December 14, 2015 18:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lauler/abb7d9275c3eab43456d to your computer and use it in GitHub Desktop.
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
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