Skip to content

Instantly share code, notes, and snippets.

@VulBusters
Created October 13, 2023 10:38
Show Gist options
  • Save VulBusters/46ea73220ebd16d928f25c912af722f2 to your computer and use it in GitHub Desktop.
Save VulBusters/46ea73220ebd16d928f25c912af722f2 to your computer and use it in GitHub Desktop.
package main
import (
"math/rand"
"time"
"io"
"net/http"
"strconv"
)
var r *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano()))
func main() {
http.HandleFunc("/", getRand)
http.ListenAndServe(":8080", nil)
}
func getRand(res http.ResponseWriter, req *http.Request) {
io.WriteString(res, getRandUint64())
}
func getRandUint64() string {
randNum := r.Uint64()
return strconv.FormatUint(randNum, 10)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment