# Is there a reason a \`MersenneTwister\` value is not broadcastable?

**URL:** https://discourse.julialang.org/t/is-there-a-reason-a-mersennetwister-value-is-not-broadcastable/20774
**Category:** General Usage
**Tags:** broadcast
**Created:** [February 14, 2019, 4:53am UTC](https://discourse.julialang.org/t/is-there-a-reason-a-mersennetwister-value-is-not-broadcastable/20774 "2019-02-14T04:53:47Z")
**Posts on this page:** 1
**Showing post:** 13

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [February 14, 2019, 12:37pm UTC](https://discourse.julialang.org/t/is-there-a-reason-a-mersennetwister-value-is-not-broadcastable/20774/13 "2019-02-14T12:37:18Z")

</div>

As mentioned by others, `broadcast` defaults to treating its arguments as collections. Types can opt in to being treated as “scalars” by defining `Base.broadcastable(x::MyType) = Ref(x)`, or you can opt-in at the call site with an explicit `Ref`.

That being said, I agree that RNG types should opt-in to being treated as scalars. Fortunately, it is a one-line non-breaking change to add this to any existing type:

[https://github.com/JuliaLang/julia/issues/31071](https://github.com/JuliaLang/julia/issues/31071)

---

_[View the full topic](https://discourse.julialang.org/t/is-there-a-reason-a-mersennetwister-value-is-not-broadcastable/20774)._
