Skip to content

Instantly share code, notes, and snippets.

@mholt
Forked from caesaneer/gen.go
Created August 16, 2019 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mholt/d66c041b8ad6e72d42e836490557d334 to your computer and use it in GitHub Desktop.
Save mholt/d66c041b8ad6e72d42e836490557d334 to your computer and use it in GitHub Desktop.
// Handler that calls generate
func ok(w http.ResponseWriter, r *http.Request) {
// res := make([]int64, 0, 100000)
var res [100000]int64
fibonacci.Generate(&res)
// fmt.Println(suc)
// fmt.Printf("%T", res)
// fmt.Println(res[50])
fmt.Fprintf(w, "OK")
}
// Generate
func Generate(data *[100000]int64) bool {
// var result [100000]int64
start := 1000
counter := 0
for start >= 1 {
var num = 90
var n1, n2, temp int64 = 0, 1, 0
for num >= 1 {
temp = n2
n1, n2 = temp, n1+n2
data[counter] = n2
counter++
num--
}
start--
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment