Commits

sweemeng committed f419c54

generate a list of positions

Comments (0)

Files changed (1)

goproj/positions/positions.go

         w.WriteHeader(http.StatusFound)
         return
     }
-
-    p := Position{u.String(),[2]float32{3.10593+rand.Float32(),101.66478+rand.Float32()}}
-    b,err := json.Marshal(p)
+    count := 10
+    parr := []Position{}
+    for i := 1; i<=count; i++ {
+        parr = append(parr,Position{u.String(),[2]float32{3.10593+rand.Float32(),101.66478+rand.Float32()}})
+    }
+    b,err := json.Marshal(parr)
     if err != nil{
         http.Error(w,err.String(),http.StatusInternalServerError)
         return
     }
     fmt.Fprint(w,string(b))
+
+
 }