我必须在Golang中执行加权随机,但出现错误:multiple-valuerandutil.WeightedChoice()insingle-valuecontext代码:packagemainimport"fmt"import"github.com/jmcvetta/randutil"funcmain(){choices:=make([]randutil.Choice,0,2)choices=append(choices,randutil.Choice{1,"dg"})choices=append(choices,randutil.Choice{2,"n"})result:=ran
我必须在Golang中执行加权随机,但出现错误:multiple-valuerandutil.WeightedChoice()insingle-valuecontext代码:packagemainimport"fmt"import"github.com/jmcvetta/randutil"funcmain(){choices:=make([]randutil.Choice,0,2)choices=append(choices,randutil.Choice{1,"dg"})choices=append(choices,randutil.Choice{2,"n"})result:=ran