aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/icrowley/fake/geo.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-16 18:21:36 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-16 18:22:00 +0200
commit1e43a6a7e35b32a95b0c533d8b2d31f242e72463 (patch)
treea52a07b97ca5daae0ca3576e3f3fe0e565818493 /vendor/github.com/icrowley/fake/geo.go
parentf510e43418aef31e8521d346abdcda6c38f34eaf (diff)
downloadgit-bug-1e43a6a7e35b32a95b0c533d8b2d31f242e72463.tar.gz
add a new main to generate random bugs
Diffstat (limited to 'vendor/github.com/icrowley/fake/geo.go')
-rw-r--r--vendor/github.com/icrowley/fake/geo.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/github.com/icrowley/fake/geo.go b/vendor/github.com/icrowley/fake/geo.go
new file mode 100644
index 00000000..12625b93
--- /dev/null
+++ b/vendor/github.com/icrowley/fake/geo.go
@@ -0,0 +1,57 @@
+package fake
+
+// Latitude generates latitude (from -90.0 to 90.0)
+func Latitude() float32 {
+ return r.Float32()*180 - 90
+}
+
+// LatitudeDegrees generates latitude degrees (from -90 to 90)
+func LatitudeDegrees() int {
+ return r.Intn(180) - 90
+}
+
+// LatitudeMinutes generates latitude minutes (from 0 to 60)
+func LatitudeMinutes() int {
+ return r.Intn(60)
+}
+
+// LatitudeSeconds generates latitude seconds (from 0 to 60)
+func LatitudeSeconds() int {
+ return r.Intn(60)
+}
+
+// LatitudeDirection generates latitude direction (N(orth) o S(outh))
+func LatitudeDirection() string {
+ if r.Intn(2) == 0 {
+ return "N"
+ }
+ return "S"
+}
+
+// Longitude generates longitude (from -180 to 180)
+func Longitude() float32 {
+ return r.Float32()*360 - 180
+}
+
+// LongitudeDegrees generates longitude degrees (from -180 to 180)
+func LongitudeDegrees() int {
+ return r.Intn(360) - 180
+}
+
+// LongitudeMinutes generates (from 0 to 60)
+func LongitudeMinutes() int {
+ return r.Intn(60)
+}
+
+// LongitudeSeconds generates (from 0 to 60)
+func LongitudeSeconds() int {
+ return r.Intn(60)
+}
+
+// LongitudeDirection generates (W(est) or E(ast))
+func LongitudeDirection() string {
+ if r.Intn(2) == 0 {
+ return "W"
+ }
+ return "E"
+}