gopherdata/gophernotes

repl.go:4:1: package rand "math/rand" has no symbol Shuffle

dfang opened this issue · 2 comments

dfang commented
import "fmt"
import "strings"
import "math"
import "math/rand"

words := strings.Fields("ink runs from the corners of my mouth")
rand.Shuffle(len(words), func(i, j int) {
    words[i], words[j] = words[j], words[i]
})
fmt.Println(words)

returns repl.go:4:1: package rand "math/rand" has no symbol Shuffle

Hello @dfang,
yes, it's missing. Gophernotes keeps compatibility with go 1.9, which does not have rand.Shuffle - it was introduced in go 1.10.

I added a lot of conditional compile to import go 1.11 symbols when compiling with go 1.11 or later, but:

  1. it does yet not include "math/rand"
  2. it only recognizes go 1.11 or later, not go 1.0

If you use go 1.11+, I should be able to solve this soon

fixed in a74a541