go - Change hex to string -
i'm going through golang tutorial, , on part
package main import ( "fmt" "math/rand" ) func main() { fmt.println("my favorite number is", rand.seed) } this returns my favorite number 0xb1c20
i have been reading on https://golang.org/pkg/math/rand/#seed i'm still bit confused how have instead of show hex show string
math/rand.seed function; printing function's location in memory. meant following:
package main import ( "fmt" "math/rand" ) func main() { rand.seed(234) // replace seed value, or set seed based off // of current time fmt.println("my favorite number is", rand.int()) }
Comments
Post a Comment