# Flip a weighted coin

**URL:** https://discourse.julialang.org/t/flip-a-weighted-coin/36947
**Category:** New to Julia
**Created:** [April 3, 2020, 10:56am UTC](https://discourse.julialang.org/t/flip-a-weighted-coin/36947 "2020-04-03T10:56:38Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [April 3, 2020, 11:15am UTC](https://discourse.julialang.org/t/flip-a-weighted-coin/36947/6 "2020-04-03T11:15:17Z")

</div>

Yea, but you can do that with the `Distributions` example too:

```julia
julia> coins = Bernoulli.([0.2, 0.5, 0.7]) # 3 coins with different weights
3-element Array{Bernoulli{Float64},1}:
 Bernoulli{Float64}(p=0.2)
 Bernoulli{Float64}(p=0.5)
 Bernoulli{Float64}(p=0.7)

julia> rand.(coins) # flip the set of coins
3-element BitArray{1}:
 0
 1
 1

```

---

_[View the full topic](https://discourse.julialang.org/t/flip-a-weighted-coin/36947)._
