samedi 6 octobre 2018

Generating a random number in a custom range

I have go script that starts on "localhost:8080/1" with a previous and next links I need to add Random link with custom range that I can change like:

  • small numbers like 100 to 200 "localhost:8080/100 - 200" and
  • even to big number like: "16567684686592643791596485465456223131545455682945955"

So:

// Get next and previous page numbers

previous := new(big.Int).Sub(page, one)
next := new(big.Int).Add(page, one)
random :=????




Aucun commentaire:

Enregistrer un commentaire