An open API service indexing awesome lists of open source software.

https://github.com/uberswe/randompick

A simple function which takes a map of weighted options and picks one at random. This might be useful for a lottery or raffle where participants might have multiple tickets.
https://github.com/uberswe/randompick

random-pick random-pick-with-weight

Last synced: about 1 year ago
JSON representation

A simple function which takes a map of weighted options and picks one at random. This might be useful for a lottery or raffle where participants might have multiple tickets.

Awesome Lists containing this project

README

          

RandomPick

A simple function which takes a map of weighted options and picks one at random. This might be useful for a lottery or raffle where participants might have multiple tickets.

```go
rand.Seed(time.Now().UnixNano())

m := map[string]int{
"Bob": 900,
"Steve": 2000,
"Kyle": 300,
}

fmt.Println(randompick.Result(m))
```