8000 GitHub - tebeka/wrand: Weighted random for Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tebeka/wrand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wrand - Weighted Random for Go

Test Go Reference

Example

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())
}

About

Weighted random for Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0