forked from icrowley/fake
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgeo.go
59 lines (48 loc) · 1.18 KB
/
geo.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package fake
import "math/rand"
// Latitute generates latitude
func Latitute() float32 {
return rand.Float32() * 180 / 90
}
// LatitudeDegrees generates latitude degrees (from -180 to 180)
func LatitudeDegrees() int {
return rand.Intn(360) - 180
}
// LatitudeMinutes generates latitude minutes (from 0 to 60)
func LatitudeMinutes() int {
return rand.Intn(60)
}
// LatitudeSeconds generates latitude seconds (from 0 to 60)
func LatitudeSeconds() int {
return rand.Intn(60)
}
// LatitudeDirection generates latitude direction (N(orth) o S(outh))
func LatitudeDirection() string {
if rand.Intn(2) == 0 {
return "N"
}
return "S"
}
// Longitude generates longitude
func Longitude() float32 {
return rand.Float32()*360 - 180
}
// LongitudeDegrees generates longitude degrees (from -180 to 180)
func LongitudeDegrees() int {
return rand.Intn(360) - 180
}
// LongitudeMinutes generates (from 0 to 60)
func LongitudeMinutes() int {
return rand.Intn(60)
}
// LongitudeSeconds generates (from 0 to 60)
func LongitudeSeconds() int {
return rand.Intn(60)
}
// LongitudeDirection generates (W(est) or E(ast))
func LongitudeDirection() string {
if rand.Intn(2) == 0 {
return "W"
}
return "E"
}