weights := map[string]int{
"A": 20,
"B": 30,
"C": 50,
}
rw, err := wrand.New(weights, nil)
if err != nil {
fmt.Printf("error: %s", err)
return
}
for i := 0; i < 5; i++ {
fmt.Println(rw.Rand())
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Weighted random for Go
License
tebeka/wrand
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Weighted random for Go
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published