forked from kyco/location-algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculations.py
More file actions
41 lines (30 loc) · 855 Bytes
/
calculations.py
File metadata and controls
41 lines (30 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from main import *
import random, decimal
def randomLong(): # generate random longitude(x)
decimal.getcontext().prec = 15
a = 18
b = decimal.Decimal(random.random())/40
longitude = a + b
return longitude
def randomLat(): # generate random latitude (y)
decimal.getcontext().prec = 15
a = 33
b = decimal.Decimal(random.random())/40
latitude = -(a + b)
return latitude
def randomRadius(): # generate random radius (r)
radius = random.randint(1,3)
return radius
def randomX(): # generate random x value
x = random.randint(0,10)
return x
def randomY(): # generate random y value
y = random.randint(0,10)
return y
def randomR(): # generate random radius r
r = random.randint(1,7)
return r
def getFractionalPart(n):
return n - int(n)
def getDecimalPart(n):
return int(n)